Don't use magic string for job transfer artifact name

Previously, the build CI/CD workflow had many occurrences of the string "build-artifacts" used for the workflow artifact
name. This made the workflow more difficult to understand and maintain. Now a single workflow scoped environment variable
is used to define the artifact name.
This commit is contained in:
per1234 2021-03-22 20:44:27 -07:00
parent f6e623ca9c
commit da424f34cc

View File

@ -13,6 +13,9 @@ on:
schedule: schedule:
- cron: '0 3 * * *' # run every day at 3AM (https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) - cron: '0 3 * * *' # run every day at 3AM (https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
env:
JOB_TRANSFER_ARTIFACT: build-artifacts
jobs: jobs:
build: build:
@ -79,7 +82,7 @@ jobs:
- name: Upload [GitHub Actions] - name: Upload [GitHub Actions]
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: build-artifacts name: ${{ env.JOB_TRANSFER_ARTIFACT }}
path: electron/build/dist/build-artifacts/ path: electron/build/dist/build-artifacts/
changelog: changelog:
@ -121,7 +124,7 @@ jobs:
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: build-artifacts name: ${{ env.JOB_TRANSFER_ARTIFACT }}
path: CHANGELOG.txt path: CHANGELOG.txt
publish: publish:
@ -132,14 +135,14 @@ jobs:
- name: Download [GitHub Actions] - name: Download [GitHub Actions]
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
name: build-artifacts name: ${{ env.JOB_TRANSFER_ARTIFACT }}
path: build-artifacts path: ${{ env.JOB_TRANSFER_ARTIFACT }}
- name: Publish Nightly [S3] - name: Publish Nightly [S3]
uses: docker://plugins/s3 uses: docker://plugins/s3
env: env:
PLUGIN_SOURCE: "build-artifacts/*" PLUGIN_SOURCE: "${{ env.JOB_TRANSFER_ARTIFACT }}/*"
PLUGIN_STRIP_PREFIX: "build-artifacts/" PLUGIN_STRIP_PREFIX: "${{ env.JOB_TRANSFER_ARTIFACT }}/"
PLUGIN_TARGET: "/arduino-ide/nightly" PLUGIN_TARGET: "/arduino-ide/nightly"
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }} PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
@ -153,8 +156,8 @@ jobs:
- name: Download [GitHub Actions] - name: Download [GitHub Actions]
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
name: build-artifacts name: ${{ env.JOB_TRANSFER_ARTIFACT }}
path: build-artifacts path: ${{ env.JOB_TRANSFER_ARTIFACT }}
- name: Get Tag - name: Get Tag
id: tag_name id: tag_name
@ -166,7 +169,7 @@ jobs:
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: ${{ steps.tag_name.outputs.TAG_NAME }} release_name: ${{ steps.tag_name.outputs.TAG_NAME }}
file: build-artifacts/* file: ${{ env.JOB_TRANSFER_ARTIFACT }}/*
tag: ${{ github.ref }} tag: ${{ github.ref }}
file_glob: true file_glob: true
body: ${{ needs.changelog.outputs.BODY }} body: ${{ needs.changelog.outputs.BODY }}
@ -174,8 +177,8 @@ jobs:
- name: Publish Release [S3] - name: Publish Release [S3]
uses: docker://plugins/s3 uses: docker://plugins/s3
env: env:
PLUGIN_SOURCE: "build-artifacts/*" PLUGIN_SOURCE: "${{ env.JOB_TRANSFER_ARTIFACT }}/*"
PLUGIN_STRIP_PREFIX: "build-artifacts/" PLUGIN_STRIP_PREFIX: "${{ env.JOB_TRANSFER_ARTIFACT }}/"
PLUGIN_TARGET: "/arduino-ide" PLUGIN_TARGET: "/arduino-ide"
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }} PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}