Skip to content

Commit 3cff836

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 002b3ab commit 3cff836

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
strategy:
2323
matrix:
24-
os:
24+
task:
2525
- Windows_32bit
2626
- Windows_64bit
2727
- Linux_32bit
@@ -40,7 +40,7 @@ jobs:
4040

4141
- name: Create changelog
4242
# Avoid creating the same changelog for each os
43-
if: matrix.os == 'Windows_32bit'
43+
if: matrix.task == 'Windows_32bit'
4444
uses: arduino/create-changelog@v1
4545
with:
4646
tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+.*$'
@@ -55,7 +55,7 @@ jobs:
5555
version: 3.x
5656

5757
- name: Build
58-
run: task dist:${{ matrix.os }}
58+
run: task dist:${{ matrix.task }}
5959

6060
- name: Upload artifacts
6161
uses: actions/upload-artifact@v3
@@ -65,7 +65,7 @@ jobs:
6565
path: ${{ env.DIST_DIR }}
6666

6767
notarize-macos:
68-
name: Notarize ${{ matrix.artifact.name }}
68+
name: Notarize ${{ matrix.build.folder-suffix }}
6969
runs-on: macos-latest
7070
needs: create-release-artifacts
7171
outputs:
@@ -77,11 +77,11 @@ jobs:
7777

7878
strategy:
7979
matrix:
80-
artifact:
81-
- name: darwin_amd64
82-
path: "macOS_64bit.tar.gz"
83-
- name: darwin_arm64
84-
path: "macOS_ARM64.tar.gz"
80+
build:
81+
- folder-suffix: darwin_amd64
82+
package-suffix: "macOS_64bit.tar.gz"
83+
- folder-suffix: darwin_arm64
84+
package-suffix: "macOS_ARM64.tar.gz"
8585

8686
steps:
8787
- name: Checkout repository
@@ -127,7 +127,7 @@ jobs:
127127
run: |
128128
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
129129
# See: https://github.com/Bearer/gon#configuration-file
130-
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"]
130+
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/${{ env.PROJECT_NAME }}"]
131131
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
132132
133133
sign {
@@ -156,9 +156,9 @@ jobs:
156156
run: |
157157
# GitHub's upload/download-artifact actions don't preserve file permissions,
158158
# so we need to add execution permission back until the action is made to do this.
159-
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"
159+
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/${{ env.PROJECT_NAME }}"
160160
TAG="${GITHUB_REF/refs\/tags\//}"
161-
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.artifact.path }}"
161+
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}"
162162
tar -czvf "$PACKAGE_FILENAME" \
163163
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
164164
-C ../../ LICENSE.txt

0 commit comments

Comments
 (0)