|
5 | 5 | tags:
|
6 | 6 | - "[0-9]+.[0-9]+.[0-9]+*"
|
7 | 7 |
|
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + id-token: write # This is required for requesting the JWT |
| 11 | + |
8 | 12 | env:
|
9 | 13 | # As defined by the Taskfile's PROJECT_NAME variable
|
10 | 14 | PROJECT_NAME: arduino-create-agent
|
|
46 | 50 | CGO_ENABLED: 0
|
47 | 51 |
|
48 | 52 | runs-on: ${{ matrix.os }}
|
| 53 | + environment: production |
49 | 54 |
|
50 | 55 | steps:
|
51 | 56 | - name: Set env vars
|
@@ -134,6 +139,7 @@ jobs:
|
134 | 139 | role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
|
135 | 140 | role-session-name: "github_${{ env.PROJECT_NAME }}"
|
136 | 141 | aws-region: ${{ env.AWS_REGION }}
|
| 142 | + if: steps.prerelease.outputs.IS_PRE != 'true' |
137 | 143 |
|
138 | 144 | - name: Upload autoupdate files to Arduino downloads servers
|
139 | 145 | run: |
|
@@ -231,6 +237,7 @@ jobs:
|
231 | 237 | env:
|
232 | 238 | GON_PATH: ${{ github.workspace }}/gon
|
233 | 239 | needs: [build, create-macos-bundle]
|
| 240 | + environment: production |
234 | 241 |
|
235 | 242 | steps:
|
236 | 243 | - name: Download artifact
|
@@ -327,6 +334,7 @@ jobs:
|
327 | 334 | role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
|
328 | 335 | role-session-name: "github_${{ env.PROJECT_NAME }}"
|
329 | 336 | aws-region: ${{ env.AWS_REGION }}
|
| 337 | + if: ${{ needs.build.outputs.prerelease != 'true' }} |
330 | 338 |
|
331 | 339 | - name: Upload autoupdate bundle to Arduino downloads servers
|
332 | 340 | run: aws s3 cp ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}${GITHUB_REF/refs\/tags\//}/ # the version should be created in th the build job
|
@@ -537,9 +545,6 @@ jobs:
|
537 | 545 | runs-on: ubuntu-20.04
|
538 | 546 | environment: production
|
539 | 547 | needs: [build, package, generate-sign-dmg]
|
540 |
| - permission: |
541 |
| - contents: write |
542 |
| - id-token: write # This is required for requesting the JWT |
543 | 548 |
|
544 | 549 | steps:
|
545 | 550 | - name: Checkout
|
@@ -591,32 +596,24 @@ jobs:
|
591 | 596 | echo "</details>" >> $GITHUB_OUTPUT
|
592 | 597 | echo "EOF" >> $GITHUB_OUTPUT
|
593 | 598 |
|
594 |
| - - name: Create Github Release |
595 |
| - uses: actions/create-release@v1 |
596 |
| - env: |
597 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 599 | + - name: Create Github Release and upload artifacts |
| 600 | + uses: ncipollo/release-action@v1 |
598 | 601 | with:
|
599 |
| - tag_name: ${{ github.ref }} |
600 |
| - release_name: ${{ github.ref }} |
| 602 | + token: ${{ secrets.GITHUB_TOKEN }} |
601 | 603 | body: ${{ steps.release_body.outputs.RBODY}}
|
602 | 604 | draft: false
|
603 | 605 | prerelease: ${{ needs.build.outputs.prerelease }}
|
604 |
| - |
605 |
| - - name: Upload release files on Github |
606 |
| - uses: svenstaro/upload-release-action@v2 |
607 |
| - with: |
608 |
| - repo_token: ${{ secrets.GITHUB_TOKEN }} |
609 |
| - tag: ${{ github.ref }} |
610 |
| - file_glob: true # If set to true, the file argument can be a glob pattern |
611 |
| - file: release/* |
612 |
| - |
| 606 | + # NOTE: "Artifact is a directory" warnings are expected and don't indicate a problem |
| 607 | + # (all the files we need are in the DIST_DIR root) |
| 608 | + artifacts: release/* |
613 | 609 |
|
614 | 610 | - name: configure aws credentials
|
615 | 611 | uses: aws-actions/configure-aws-credentials@v4
|
616 | 612 | with:
|
617 | 613 | role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
|
618 | 614 | role-session-name: "github_${{ env.PROJECT_NAME }}"
|
619 | 615 | aws-region: ${{ env.AWS_REGION }}
|
| 616 | + if: ${{ needs.build.outputs.prerelease != 'true' }} |
620 | 617 |
|
621 | 618 | - name: Upload release files on Arduino downloads servers
|
622 | 619 | run: aws s3 sync release/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}
|
|
0 commit comments