@@ -95,14 +95,45 @@ jobs:
9595 name : ${{ runner.os }}
9696 path : _release/stack-*
9797
98+ configuration :
99+ name : Check for self-hosted runners
100+ runs-on : ubuntu-latest
101+ env :
102+ CAN_SIGN : ${{ secrets.RELEASE_SIGNING_KEY != '' }}
103+ outputs :
104+ arm64 : ${{ steps.runners.outputs.arm64 }}
105+ can-sign : ${{ env.CAN_SIGN }}
106+ steps :
107+ - name : Check for hosted runners
108+ id : runners
109+ shell : bash
110+ env :
111+ SELF_HOSTED_RUNNERS : ${{ secrets.SELF_HOSTED_RUNNERS || (github.repository_owner == 'commercialhaskell' && 'arm64') }}
112+ run : |
113+ echo "::set-output name=runners::$SELF_HOSTED_RUNNERS"
114+ if echo "$SELF_HOSTED_RUNNERS" | grep -q 'arm64'; then
115+ echo "::set-output name=arm64::['self-hosted', 'linux', 'ARM64']"
116+ else
117+ echo '::set-output name=arm64::"ubuntu-latest"'
118+ fi
119+
98120 linux-arm64 :
99121 name : Linux ARM64
100- runs-on : [self-hosted, linux, ARM64]
122+ runs-on : ${{ fromJSON(needs.configuration.outputs.arm64) }}
123+ needs : configuration
101124 steps :
125+ - name : Skipping ARM64
126+ if : needs.configuration.outputs.arm64 == 'ubuntu-latest'
127+ shell : bash
128+ run : |
129+ echo '::notice title=ARM64 skipped::To build ARM64, a self-hosted runner needs to be configured and the SELF_HOSTED_RUNNERS secret must contain arm64'
130+
102131 - name : Clone project
132+ if : needs.configuration.outputs.arm64 != 'ubuntu-latest'
103133 uses : actions/checkout@v3
104134
105135 - name : Build bindist
136+ if : needs.configuration.outputs.arm64 != 'ubuntu-latest'
106137 shell : bash
107138 run : |
108139 set -ex
@@ -112,13 +143,16 @@ jobs:
112143 docker run --rm -v $(pwd):/src -w /src stack bash -c "/home/stack/release build"
113144
114145 - name : Upload bindist
146+ if : needs.configuration.outputs.arm64 != 'ubuntu-latest'
115147 uses : actions/upload-artifact@v3
116148 with :
117149 name : Linux-ARM64
118150 path : _release/stack-*
119151
120152 github-release :
121- name : Create Github release
153+ name : Create GitHub release
154+ permissions :
155+ contents : write
122156 needs :
123157 - integration-tests
124158 - linux-arm64
@@ -141,11 +175,13 @@ jobs:
141175 name : Windows
142176 path : _release
143177 - name : Download Linux-ARM64 artifact
178+ if : contains(needs.configuration.outputs.runners, 'arm64')
144179 uses : actions/download-artifact@v3
145180 with :
146181 name : Linux-ARM64
147182 path : _release
148183 - name : Hash and sign assets
184+ if : needs.configuration.outputs.can-sign
149185 shell : bash
150186 env :
151187 RELEASE_SIGNING_KEY : ${{ secrets.RELEASE_SIGNING_KEY }}
@@ -157,17 +193,17 @@ jobs:
157193 shasum -a 256 "$asset" >"$asset.sha256"
158194 gpg --digest-algo=sha512 --detach-sig --armor -u 0x575159689BEFB442 "$asset"
159195 done
160- - name : Set Github ref variables
196+ - name : Set GitHub ref variables
161197 id : github_ref_vars
162198 run : |
163199 echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
164- - name : Create Github release (final)
200+ - name : Create GitHub release (final)
165201 if : " !startsWith(github.ref, 'refs/tags/rc/')"
166- uses : actions/create- release@v1
202+ uses : ncipollo/ release-action @v1.10.0
167203 env :
168204 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
169205 with :
170- tag_name : ${{ github.ref }}
206+ tag : ${{ github.ref }}
171207 body : |
172208 See https://haskellstack.org/ for installation and upgrade instructions.
173209
@@ -180,20 +216,20 @@ jobs:
180216 [INSERT CONTRIBUTORS]
181217 draft : true
182218 prerelease : false
183- - name : Create Github release (release candidate)
219+ - name : Create GitHub release (release candidate)
184220 if : " startsWith(github.ref, 'refs/tags/rc/')"
185- uses : actions/create- release@v1
221+ uses : ncipollo/ release-action @v1.10.0
186222 env :
187223 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
188224 with :
189- tag_name : ${{ github.ref }}
225+ tag : ${{ github.ref }}
190226 body : |
191227 **Changes since v[INSERT PREVIOUS VERSION]:**
192228
193229 [INSERT CHANGELOG]
194230 draft : true
195231 prerelease : true
196- - name : Upload assets to Github release (final)
232+ - name : Upload assets to GitHub release (final)
197233 if : " !startsWith(github.ref, 'refs/tags/rc/')"
198234 uses : xresloader/upload-to-github-release@v1
199235 env :
@@ -204,7 +240,7 @@ jobs:
204240 draft : true
205241 prerelease : false
206242 overwrite : true
207- - name : Upload assets to Github release (release candidate)
243+ - name : Upload assets to GitHub release (release candidate)
208244 if : " startsWith(github.ref, 'refs/tags/rc/')"
209245 uses : xresloader/upload-to-github-release@v1
210246 env :
0 commit comments