Skip to content

Commit da424f3

Browse files
committed
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.
1 parent f6e623c commit da424f3

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

Diff for: .github/workflows/build.yml

+14-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
schedule:
1414
- cron: '0 3 * * *' # run every day at 3AM (https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
1515

16+
env:
17+
JOB_TRANSFER_ARTIFACT: build-artifacts
18+
1619
jobs:
1720

1821
build:
@@ -79,7 +82,7 @@ jobs:
7982
- name: Upload [GitHub Actions]
8083
uses: actions/upload-artifact@v2
8184
with:
82-
name: build-artifacts
85+
name: ${{ env.JOB_TRANSFER_ARTIFACT }}
8386
path: electron/build/dist/build-artifacts/
8487

8588
changelog:
@@ -121,7 +124,7 @@ jobs:
121124
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
122125
uses: actions/upload-artifact@v2
123126
with:
124-
name: build-artifacts
127+
name: ${{ env.JOB_TRANSFER_ARTIFACT }}
125128
path: CHANGELOG.txt
126129

127130
publish:
@@ -132,14 +135,14 @@ jobs:
132135
- name: Download [GitHub Actions]
133136
uses: actions/download-artifact@v2
134137
with:
135-
name: build-artifacts
136-
path: build-artifacts
138+
name: ${{ env.JOB_TRANSFER_ARTIFACT }}
139+
path: ${{ env.JOB_TRANSFER_ARTIFACT }}
137140

138141
- name: Publish Nightly [S3]
139142
uses: docker://plugins/s3
140143
env:
141-
PLUGIN_SOURCE: "build-artifacts/*"
142-
PLUGIN_STRIP_PREFIX: "build-artifacts/"
144+
PLUGIN_SOURCE: "${{ env.JOB_TRANSFER_ARTIFACT }}/*"
145+
PLUGIN_STRIP_PREFIX: "${{ env.JOB_TRANSFER_ARTIFACT }}/"
143146
PLUGIN_TARGET: "/arduino-ide/nightly"
144147
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
145148
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -153,8 +156,8 @@ jobs:
153156
- name: Download [GitHub Actions]
154157
uses: actions/download-artifact@v2
155158
with:
156-
name: build-artifacts
157-
path: build-artifacts
159+
name: ${{ env.JOB_TRANSFER_ARTIFACT }}
160+
path: ${{ env.JOB_TRANSFER_ARTIFACT }}
158161

159162
- name: Get Tag
160163
id: tag_name
@@ -166,16 +169,16 @@ jobs:
166169
with:
167170
repo_token: ${{ secrets.GITHUB_TOKEN }}
168171
release_name: ${{ steps.tag_name.outputs.TAG_NAME }}
169-
file: build-artifacts/*
172+
file: ${{ env.JOB_TRANSFER_ARTIFACT }}/*
170173
tag: ${{ github.ref }}
171174
file_glob: true
172175
body: ${{ needs.changelog.outputs.BODY }}
173176

174177
- name: Publish Release [S3]
175178
uses: docker://plugins/s3
176179
env:
177-
PLUGIN_SOURCE: "build-artifacts/*"
178-
PLUGIN_STRIP_PREFIX: "build-artifacts/"
180+
PLUGIN_SOURCE: "${{ env.JOB_TRANSFER_ARTIFACT }}/*"
181+
PLUGIN_STRIP_PREFIX: "${{ env.JOB_TRANSFER_ARTIFACT }}/"
179182
PLUGIN_TARGET: "/arduino-ide"
180183
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
181184
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}

0 commit comments

Comments
 (0)