Skip to content

Commit 888f9fd

Browse files
committed
Fix release dependency in GH workflow
1 parent 8bff351 commit 888f9fd

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ on:
99
- published
1010

1111
jobs:
12-
pre-flight-check:
12+
lint-and-test:
1313
uses:
1414
./.github/workflows/pre-release.yml
1515
with:
1616
build: 'false'
1717
release-check:
1818
runs-on: self-hosted
19-
needs: pre-flight-check
19+
needs: lint-and-test
2020
outputs:
2121
release-id: ${{ steps.get-release-id.outputs.release_id }}
2222
steps:
@@ -44,7 +44,7 @@ jobs:
4444
# Upload assets for different OS and Architecture
4545
upload_assets:
4646
if: ${{ github.event_name == 'release' }}
47-
needs: [pre-flight-check, release-check]
47+
needs: release-check
4848
strategy:
4949
matrix:
5050
platform:
@@ -205,25 +205,27 @@ jobs:
205205
steps:
206206
- name: Release ID Propagation
207207
run: |
208-
if [ -n "${{ needs.pre-flight-check.outputs.release-id }}" ]; then
209-
echo "Release ID propagated: ${{ needs.pre-flight-check.outputs.release-id }}"
208+
if [ -n "${{ needs.release-check.outputs.release-id }}" ]; then
209+
echo "Release ID propagated: ${{ needs.release-check.outputs.release-id }}"
210210
else
211211
echo "Release ID propagation failed. Exiting.."
212212
exit 1
213213
fi
214214
shell: bash
215-
- shell: bash
215+
- name: Targeted Release
216216
# checks if the `release_for` is part of a comma separated variable in GitHub
217-
# this is to prevent exhausting GH actions, input should be: linux-amd64,darwin-amd64,windows-amd64
217+
# this is to prevent exhausting GH actions needlessly
218+
# sample input for the gh variable `target_os`: linux-amd64,darwin-amd64,windows-amd64
218219
run: |
219220
release=true;
220221
if [ "${{ vars.target_os }}" ]; then
221222
if [[ ",${{ vars.target_os }}," != *",${{ matrix.platform.release_for }},"* ]]; then
222-
echo "Skipping release for ${{ matrix.platform.release_for }}, expected ${{ vars.target_os }}"
223+
echo "Skipping release for ${{ matrix.platform.release_for }}, expected any of [${{ vars.target_os }}]"
223224
release=false;
224225
fi
225226
fi
226227
echo "release=$release" >> $GITHUB_ENV
228+
shell: bash
227229
- uses: actions/checkout@v4
228230
if: env.release == 'true'
229231
with:
@@ -287,5 +289,5 @@ jobs:
287289
curl -X POST -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \
288290
-H "Content-Type: application/octet-stream" \
289291
--data-binary @"${{ matrix.platform.name }}" \
290-
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ needs.pre-flight-check.outputs.release-id }}/assets?name=${{ matrix.platform.name }}"
292+
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ needs.release-check.outputs.release-id }}/assets?name=${{ matrix.platform.name }}"
291293
shell: bash

0 commit comments

Comments
 (0)