-
Notifications
You must be signed in to change notification settings - Fork 1
169 lines (163 loc) 路 6.2 KB
/
Copy pathrelease.yml
File metadata and controls
169 lines (163 loc) 路 6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-x86_64-linux:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- uses: cachix/cachix-action@v16
with:
name: brack-lang
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build ".#packages.x86_64-linux.default"
- uses: actions/upload-artifact@v4
with:
name: brack-x86_64-linux
path: result/bin/brack
- uses: actions/upload-artifact@v4
with:
name: brack-release-x86_64-linux
path: result/bin/brack-release
build-x86_64-darwin:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- uses: cachix/cachix-action@v16
with:
name: brack-lang
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build ".#packages.x86_64-darwin.default"
- uses: actions/upload-artifact@v4
with:
name: brack-x86_64-darwin
path: result/bin/brack
- uses: actions/upload-artifact@v4
with:
name: brack-release-x86_64-darwin
path: result/bin/brack-release
build-aarch64-darwin:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- uses: cachix/cachix-action@v16
with:
name: brack-lang
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build ".#packages.aarch64-darwin.default"
- uses: actions/upload-artifact@v4
with:
name: brack-aarch64-darwin
path: result/bin/brack
- uses: actions/upload-artifact@v4
with:
name: brack-release-aarch64-darwin
path: result/bin/brack-release
tag:
runs-on: ubuntu-24.04
needs: [ build-x86_64-linux, build-x86_64-darwin, build-aarch64-darwin ]
outputs:
version: ${{ steps.version.outputs.version }}
sha_x86_64_linux: ${{ steps.calc-sha.outputs.x86_64_linux }}
sha_x86_64_darwin: ${{ steps.calc-sha.outputs.x86_64_darwin }}
sha_aarch64_darwin: ${{ steps.calc-sha.outputs.aarch64_darwin }}
steps:
- uses: actions/checkout@v4
- name: Get current version
id: version
run: |
echo "version=$(cat ./VERSION)" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
name: brack-x86_64-linux
path: x86_64-linux
# - uses: actions/download-artifact@v4
# with:
# name: brack-release-x86_64-linux
# path: x86_64-linux
- uses: actions/download-artifact@v4
with:
name: brack-x86_64-darwin
path: x86_64-darwin
# - uses: actions/download-artifact@v4
# with:
# name: brack-release-x86_64-darwin
# path: x86_64-darwin
- uses: actions/download-artifact@v4
with:
name: brack-aarch64-darwin
path: aarch64-darwin
# - uses: actions/download-artifact@v4
# with:
# name: brack-release-aarch64-darwin
# path: aarch64-darwin
- run: |
mv x86_64-linux/brack x86_64-linux/brack-x86_64-linux
# mv x86_64-linux/brack-release x86_64-linux/brack-release-x86_64-linux
mv x86_64-darwin/brack x86_64-darwin/brack-x86_64-darwin
# mv x86_64-darwin/brack-release x86_64-darwin/brack-release-x86_64-darwin
mv aarch64-darwin/brack aarch64-darwin/brack-aarch64-darwin
# mv aarch64-darwin/brack-release aarch64-darwin/brack-release-aarch64-darwin
- id: calc-sha
run: |
X86_64_LINUX_SHA=$(shasum -a 256 x86_64-linux/brack-x86_64-linux | cut -d ' ' -f1)
X86_64_DARWIN_SHA=$(shasum -a 256 x86_64-darwin/brack-x86_64-darwin | cut -d ' ' -f1)
AARCH64_DARWIN_SHA=$(shasum -a 256 aarch64-darwin/brack-aarch64-darwin | cut -d ' ' -f1)
{
echo "x86_64_linux=$X86_64_LINUX_SHA"
echo "x86_64_darwin=$X86_64_DARWIN_SHA"
echo "aarch64_darwin=$AARCH64_DARWIN_SHA"
} >> "$GITHUB_OUTPUT"
- name: Create release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: v${{ steps.version.outputs.version }}
draft: false
prerelease: ${{ contains(github.ref, '-rc') }}
generate_release_notes: true
files: |
x86_64-linux/brack-x86_64-linux
x86_64-darwin/brack-x86_64-darwin
aarch64-darwin/brack-aarch64-darwin
update-homebrew-tap:
runs-on: ubuntu-24.04
needs: tag
steps:
- uses: actions/checkout@v4
with:
repository: brack-lang/homebrew-tap
path: homebrew-tap
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
- run: |
{
echo "VERSION=${{ needs.tag.outputs.version }}"
echo "SHA_X86_64_LINUX=${{ needs.tag.outputs.sha_x86_64_linux }}"
echo "SHA_X86_64_DARWIN=${{ needs.tag.outputs.sha_x86_64_darwin }}"
echo "SHA_AARCH64_DARWIN=${{ needs.tag.outputs.sha_aarch64_darwin }}"
} >> "$GITHUB_ENV"
- if: contains(github.ref, '-rc')
run: echo "FILE_NAME=brack-rc.rb" >> "$GITHUB_ENV"
- if: ${{ !contains(github.ref, '-rc') }}
run: echo "FILE_NAME=brack.rb" >> "$GITHUB_ENV"
- run: |
cd homebrew-tap
NEW_VERSION="${VERSION#v}"
sed -i "s|^ version \".*\"| version \"${NEW_VERSION}\"|" "Formula/${FILE_NAME}"
sed -i "s|^ x86_64_darwin_sha256 = \".*\"| x86_64_darwin_sha256 = \"${SHA_X86_64_DARWIN}\"|" "Formula/${FILE_NAME}"
sed -i "s|^ aarch64_darwin_sha256 = \".*\"| aarch64_darwin_sha256 = \"${SHA_AARCH64_DARWIN}\"|" "Formula/${FILE_NAME}"
sed -i "s|^ x86_64_linux_sha256 = \".*\"| x86_64_linux_sha256 = \"${SHA_X86_64_LINUX}\"|" "Formula/${FILE_NAME}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add "Formula/${FILE_NAME}"
git commit -m "Update ${FILE_NAME} for ${VERSION}"
git push origin main