Skip to content

Commit 01db4ea

Browse files
umbynoscmaglie
authored andcommitted
Upload the signed bundle to s3 (#756)
* remove some code duplication regarding prerelease calculation * add upload of the notarized bundle to s3 download bucket * add upload of the notarized bundle to s3 download bucket
1 parent 0aafda1 commit 01db4ea

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

.github/workflows/release.yml

+13-15
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
env:
99
# As defined by the Taskfile's PROJECT_NAME variable
1010
PROJECT_NAME: arduino-create-agent
11-
TARGET: "/CreateAgent/Stable"
11+
TARGET: "/CreateAgent/Stable/"
1212
OLD_TARGET: "/CreateBridge/" # compatibility with older releases (we can't change config.ini)
1313
VERSION_TARGET: "arduino-create-static/agent-metadata/"
1414
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -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]
@@ -204,13 +206,13 @@ jobs:
204206
name: ArduinoCreateAgent.app
205207
path: ArduinoCreateAgent.app.tar
206208

207-
# The notarize-macos job will download the macos bundle from the previous job, sign, notarize and re-upload it.
209+
# The notarize-macos job will download the macos bundle from the previous job, sign, notarize and re-upload it, uploading it also on s3 download servers for the autoupdate.
208210
notarize-macos:
209211
name: Notarize bundle
210212
runs-on: macos-12
211213
env:
212214
GON_PATH: ${{ github.workspace }}/gon
213-
needs: create-macos-bundle
215+
needs: [build, create-macos-bundle]
214216

215217
steps:
216218
- name: Download artifact
@@ -276,6 +278,10 @@ jobs:
276278
277279
- name: Sign and notarize binary
278280
run: gon -log-level=debug -log-json "${{ env.GON_CONFIG_PATH }}"
281+
282+
- name: Upload autoupdate bundle to Arduino downloads servers
283+
run: aws s3 cp ArduinoCreateAgent.app_notarized.zip s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}${GITHUB_REF/refs\/tags\//}/ # the version should be created in th the build job
284+
if: ${{ needs.build.outputs.prerelease != 'true' }}
279285

280286
- name: Upload artifact
281287
uses: actions/upload-artifact@v3
@@ -493,7 +499,7 @@ jobs:
493499

494500
create-release:
495501
runs-on: ubuntu-20.04
496-
needs: code-sign-mac-installers
502+
needs: [build, code-sign-mac-installers]
497503

498504
steps:
499505
- name: Checkout
@@ -504,14 +510,6 @@ jobs:
504510
- name: Download artifact
505511
uses: actions/download-artifact@v3 # download all the artifacts
506512

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-
515513
# mandatory step because upload-release-action does not support multiple folders
516514
- name: prepare artifacts for the release
517515
run: |
@@ -562,7 +560,7 @@ jobs:
562560
release_name: ${{ github.ref }}
563561
body: ${{ steps.release_body.outputs.RBODY}}
564562
draft: false
565-
prerelease: ${{ steps.prerelease.outputs.IS_PRE }}
563+
prerelease: ${{ needs.build.outputs.prerelease }}
566564

567565
- name: Upload release files on Github
568566
uses: svenstaro/upload-release-action@v2
@@ -574,10 +572,10 @@ jobs:
574572

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

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

0 commit comments

Comments
 (0)