@@ -71,3 +71,129 @@ jobs:
71
71
branch : main
72
72
env :
73
73
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
74
+ - name : Get version number
75
+ id : get-version-number
76
+ # TODO: replace this step with https://github.com/taiki-e/create-gh-release-action/pull/12 once that lands
77
+ run : |
78
+ TAG_NAME=${{ github.ref_name }}
79
+ VERSION=${TAG_NAME#"cargo-nextest-"}
80
+ echo "The version number is $VERSION"
81
+ echo "::set-output name=version::$VERSION"
82
+ outputs :
83
+ version : ${{ steps.get-version-number.outputs.version }}
84
+
85
+ build-cargo-nextest-binaries :
86
+ name : Build cargo-nextest binaries for ${{ matrix.target }}
87
+ if : github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'cargo-nextest-')
88
+ needs :
89
+ - cargo-nextest-release
90
+ strategy :
91
+ matrix :
92
+ include :
93
+ - target : x86_64-unknown-linux-gnu
94
+ os : ubuntu-18.04
95
+ - target : x86_64-pc-windows-msvc
96
+ os : windows-latest
97
+ runs-on : ${{ matrix.os }}
98
+ steps :
99
+ - uses : actions/checkout@v2
100
+ - name : Install Rust
101
+ uses : actions-rs/toolchain@v1
102
+ with :
103
+ toolchain : stable
104
+ profile : minimal
105
+ override : true
106
+ - uses : taiki-e/upload-rust-binary-action@v1
107
+ with :
108
+ bin : cargo-nextest
109
+ # The tag name contains the binary name so just use that.
110
+ archive : $tag-$target
111
+ target : ${{ matrix.target }}
112
+ tar : all
113
+ zip : windows
114
+ env :
115
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
116
+ CARGO_PROFILE_RELEASE_LTO : true
117
+ - name : Set archive output variable
118
+ id : archive-output
119
+ shell : bash
120
+ run : |
121
+ if [[ ${{ matrix.target }} == windows ]]; then
122
+ echo "::set-output name=${{ matrix.target }}::${{ github.ref_name }}-${{ matrix.target }}".zip
123
+ else
124
+ echo "::set-output name=${{ matrix.target }}::${{ github.ref_name }}-${{ matrix.target }}".tar.gz
125
+ fi
126
+ outputs :
127
+ linux-tar : ${{ steps.archive-output.outputs.x86_64-unknown-linux-gnu }}
128
+ windows-zip : ${{ steps.archive-output.outputs.x86_64-pc-windows-msvc }}
129
+
130
+ build-cargo-nextest-binaries-mac :
131
+ name : Build universal cargo-nextest binary for Mac
132
+ if : github.repository_owner == 'nextest-rs'
133
+ needs :
134
+ - cargo-nextest-release
135
+ runs-on : macos-latest
136
+ steps :
137
+ - uses : actions/checkout@v2
138
+ - name : Install Rust
139
+ uses : actions-rs/toolchain@v1
140
+ with :
141
+ toolchain : stable
142
+ profile : minimal
143
+ override : true
144
+ - name : Build release for Mac
145
+ id : build-release
146
+ run : |
147
+ ./scripts/release-mac-build.sh cargo-nextest "${{ github.ref_name }}"
148
+ - uses : svenstaro/upload-release-action@2.2.1
149
+ with :
150
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
151
+ file : ${{ steps.build-release.outputs.archive-name }}
152
+ tag : ${{ github.ref }}
153
+ outputs :
154
+ mac-tar : ${{ steps.build-release.outputs.archive-name }}
155
+
156
+ update-release-meta :
157
+ name : Update release-meta branch
158
+ if : github.repository_owner == 'nextest-rs'
159
+ needs :
160
+ - cargo-nextest-release
161
+ - build-cargo-nextest-binaries
162
+ - build-cargo-nextest-binaries-mac
163
+ runs-on : ubuntu-latest
164
+ steps :
165
+ - uses : actions/checkout@v2
166
+ - name : Download mukti
167
+ run : |
168
+ mkdir -p ~/bin
169
+ curl -LsSf "https://github.com/sunshowers/mukti/releases/download/mukti-bin-0.1.0/mukti-bin-0.1.0-x86_64-unknown-linux-gnu.tar.gz" \
170
+ | tar xzf - -C ~/bin
171
+ - name : Add release metadata
172
+ run : |
173
+ ~/bin/mukti-bin add-release --version ${{ needs.cargo-nextest-release.outputs.version }} \
174
+ --url-prefix "https://github.com/nextest-rs/nextest/releases/download/${{ github.ref_name }}" \
175
+ --archive x86_64-unknown-linux-gnu=${{ needs.build-cargo-nextest-binaries.outputs.linux-tar }} \
176
+ --archive x86_64-pc-windows-msvc=${{ needs.build-cargo-nextest-binaries.outputs.windows-zip }} \
177
+ --archive universal-apple-darwin=${{ needs.build-cargo-nextest-binaries-mac.outputs.mac-tar }}
178
+ - name : Generate netlify redirects
179
+ run : |
180
+ mkdir out-dir
181
+ ~/bin/mukti-bin generate-netlify out-dir --alias linux=x86_64-unknown-linux-gnu \
182
+ --alias windows=x86_64-pc-windows-msvc --alias mac=universal-apple-darwin
183
+ - name : Update releases.json on main branch
184
+ uses : EndBug/add-and-commit@v8
185
+ with :
186
+ add : .releases.json
187
+ message : " Update release metadata for ${{ github.ref_name }}"
188
+ default_author : github_actions
189
+ # Need to specify pull and push arguments because we're checked out to a tag here (i.e. not on a branch)
190
+ pull : ' --rebase --autostash origin main'
191
+ push : ' origin HEAD:main'
192
+ - name : Copy releases.json to output dir
193
+ run : |
194
+ cp .releases.json out-dir/releases.json
195
+ - name : Deploy release metadata
196
+ uses : JamesIves/github-pages-deploy-action@v4
197
+ with :
198
+ branch : release-meta
199
+ folder : out-dir
0 commit comments