Skip to content

Commit a4b470f

Browse files
committed
remove some code duplication regarding prerelease calculation
1 parent 9c352b3 commit a4b470f

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

.github/workflows/release.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ env:
2626
jobs:
2727
# The build job is responsible for: configuring the environment, testing and compiling process
2828
build:
29+
outputs:
30+
prerelease: ${{ steps.prerelease.outputs.IS_PRE }}
2931
strategy:
3032
matrix:
3133
os: [ubuntu-20.04, windows-2019, macos-12]
@@ -493,7 +495,7 @@ jobs:
493495

494496
create-release:
495497
runs-on: ubuntu-20.04
496-
needs: code-sign-mac-installers
498+
needs: [build, code-sign-mac-installers]
497499

498500
steps:
499501
- name: Checkout
@@ -504,14 +506,6 @@ jobs:
504506
- name: Download artifact
505507
uses: actions/download-artifact@v3 # download all the artifacts
506508

507-
- name: Identify Prerelease
508-
# This is a workaround while waiting for create-release action to implement auto pre-release based on tag
509-
id: prerelease
510-
run: |
511-
curl -L -s https://github.com/fsaintjacques/semver-tool/archive/3.1.0.zip -o /tmp/3.1.0.zip
512-
unzip -p /tmp/3.1.0.zip semver-tool-3.1.0/src/semver >/tmp/semver && chmod +x /tmp/semver
513-
if [[ $(/tmp/semver get prerel ${GITHUB_REF/refs\/tags\//}) ]]; then echo "IS_PRE=true" >> $GITHUB_OUTPUT; fi
514-
515509
# mandatory step because upload-release-action does not support multiple folders
516510
- name: prepare artifacts for the release
517511
run: |
@@ -562,7 +556,7 @@ jobs:
562556
release_name: ${{ github.ref }}
563557
body: ${{ steps.release_body.outputs.RBODY}}
564558
draft: false
565-
prerelease: ${{ steps.prerelease.outputs.IS_PRE }}
559+
prerelease: ${{ needs.build.outputs.prerelease }}
566560

567561
- name: Upload release files on Github
568562
uses: svenstaro/upload-release-action@v2
@@ -574,10 +568,10 @@ jobs:
574568

575569
- name: Upload release files on Arduino downloads servers
576570
run: aws s3 sync release/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}
577-
if: steps.prerelease.outputs.IS_PRE != 'true'
571+
if: $ {{ needs.build.outputs.prerelease }} != 'true'
578572

579573
- name: Update version file (used by frontend to trigger autoupdate and create filename)
580574
run: |
581575
echo {\"Version\": \"${GITHUB_REF##*/}\"} > /tmp/agent-version.json
582576
aws s3 cp /tmp/agent-version.json s3://${{ env.VERSION_TARGET }}
583-
if: steps.prerelease.outputs.IS_PRE != 'true'
577+
if: $ {{ needs.build.outputs.prerelease }} != 'true'

0 commit comments

Comments
 (0)