Skip to content

Commit ec2c0c5

Browse files
committed
Use more meaningful variable names in release workflow
A GitHub Actions workflow is used to automatically generate 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 517dcc5 commit ec2c0c5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

@@ -74,11 +74,11 @@ jobs:
7474

7575
strategy:
7676
matrix:
77-
artifact:
78-
- name: darwin_amd64
79-
path: "macOS_64bit.tar.gz"
80-
- name: darwin_arm64
81-
path: "macOS_ARM64.tar.gz"
77+
build:
78+
- folder-suffix: darwin_amd64
79+
package-suffix: "macOS_64bit.tar.gz"
80+
- folder-suffix: darwin_arm64
81+
package-suffix: "macOS_ARM64.tar.gz"
8282

8383
steps:
8484
- name: Checkout repository
@@ -124,7 +124,7 @@ jobs:
124124
run: |
125125
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
126126
# See: https://github.com/Bearer/gon#configuration-file
127-
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"]
127+
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/${{ env.PROJECT_NAME }}"]
128128
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
129129
130130
sign {
@@ -154,10 +154,10 @@ jobs:
154154
run: |
155155
# GitHub's upload/download-artifact actions don't preserve file permissions,
156156
# so we need to add execution permission back until the action is made to do this.
157-
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"
157+
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/${{ env.PROJECT_NAME }}"
158158
TAG="${GITHUB_REF/refs\/tags\//}"
159-
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.artifact.path }}"
160-
tar -czvf "$PACKAGE_FILENAME" "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}"
159+
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}"
160+
tar -czvf "$PACKAGE_FILENAME" "${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}"
161161
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
162162
163163
- name: Upload artifact

0 commit comments

Comments
 (0)