Skip to content

Commit 825da3a

Browse files
committed
Use more meaningful variable names in release workflows
GitHub Actions workflows are used to automatically generate beta tester and production builds of the project. A separate build is generated for each of the target host types. This is done using a job matrix, which creates a parallel run of the workflow job for each target. The matrix defines variables that provide the data that is specific to each job. The variable names used previously did not clearly communicate their nature: - The variable for the task name was named "os" - The variables for the build filename components used the term "artifact", which is ambiguous in this context where the term is otherwise used to refer to the completely unrelated workflow artifacts These variable names made it very difficult for anyone not intimately familiar with the workings of the workflow to understand its code.
1 parent a8c5479 commit 825da3a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

.github/workflows/release-go-crosscompile-task.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
strategy:
2525
matrix:
26-
os:
26+
task:
2727
- Windows_32bit
2828
- Windows_64bit
2929
- Linux_32bit
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Create changelog
4444
# Avoid creating the same changelog for each os
45-
if: matrix.os == 'Windows_32bit'
45+
if: matrix.task == 'Windows_32bit'
4646
uses: arduino/create-changelog@v1
4747
with:
4848
tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+.*$'
@@ -62,7 +62,7 @@ jobs:
6262
version: 3.x
6363

6464
- name: Build
65-
run: task dist:${{ matrix.os }}
65+
run: task dist:${{ matrix.task }}
6666

6767
- name: Upload artifacts
6868
uses: actions/upload-artifact@v3
@@ -72,7 +72,7 @@ jobs:
7272
path: ${{ env.DIST_DIR }}
7373

7474
notarize-macos:
75-
name: Notarize ${{ matrix.artifact.name }}
75+
name: Notarize ${{ matrix.build.folder-suffix }}
7676
runs-on: macos-latest
7777
needs: create-release-artifacts
7878
outputs:
@@ -84,11 +84,11 @@ jobs:
8484

8585
strategy:
8686
matrix:
87-
artifact:
88-
- name: darwin_amd64
89-
path: "macOS_64bit.tar.gz"
90-
- name: darwin_arm64
91-
path: "macOS_ARM64.tar.gz"
87+
build:
88+
- folder-suffix: darwin_amd64
89+
package-suffix: "macOS_64bit.tar.gz"
90+
- folder-suffix: darwin_arm64
91+
package-suffix: "macOS_ARM64.tar.gz"
9292

9393
steps:
9494
- name: Checkout repository
@@ -133,7 +133,7 @@ jobs:
133133
run: |
134134
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
135135
# See: https://github.com/Bearer/gon#configuration-file
136-
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"]
136+
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/${{ env.PROJECT_NAME }}"]
137137
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
138138
139139
sign {
@@ -162,10 +162,10 @@ jobs:
162162
run: |
163163
# GitHub's upload/download-artifact actions don't preserve file permissions,
164164
# so we need to add execution permission back until the action is made to do this.
165-
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"
165+
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/${{ env.PROJECT_NAME }}"
166166
TAG="${GITHUB_REF/refs\/tags\//}"
167-
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.artifact.path }}"
168-
tar -czvf "$PACKAGE_FILENAME" "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}"
167+
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}"
168+
tar -czvf "$PACKAGE_FILENAME" "${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/"
169169
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
170170
171171
- name: Upload artifact

0 commit comments

Comments
 (0)