Skip to content

Commit f13b9db

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 ee51545 commit f13b9db

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

.github/workflows/publish-go-tester-task.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
8080
build:
8181
needs: package-name-prefix
82-
name: Build ${{ matrix.os.name }}
82+
name: Build ${{ matrix.os.artifact-name }}
8383
runs-on: ubuntu-latest
8484
permissions:
8585
contents: read
@@ -89,31 +89,31 @@ jobs:
8989
os:
9090
- task: Windows_32bit
9191
path: "*Windows_32bit.zip"
92-
name: Windows_X86-32
92+
artifact-name: Windows_X86-32
9393
- task: Windows_64bit
9494
path: "*Windows_64bit.zip"
95-
name: Windows_X86-64
95+
artifact-name: Windows_X86-64
9696
- task: Linux_32bit
9797
path: "*Linux_32bit.tar.gz"
98-
name: Linux_X86-32
98+
artifact-name: Linux_X86-32
9999
- task: Linux_64bit
100100
path: "*Linux_64bit.tar.gz"
101-
name: Linux_X86-64
101+
artifact-name: Linux_X86-64
102102
- task: Linux_ARMv6
103103
path: "*Linux_ARMv6.tar.gz"
104-
name: Linux_ARMv6
104+
artifact-name: Linux_ARMv6
105105
- task: Linux_ARMv7
106106
path: "*Linux_ARMv7.tar.gz"
107-
name: Linux_ARMv7
107+
artifact-name: Linux_ARMv7
108108
- task: Linux_ARM64
109109
path: "*Linux_ARM64.tar.gz"
110-
name: Linux_ARM64
110+
artifact-name: Linux_ARM64
111111
- task: macOS_64bit
112112
path: "*macOS_64bit.tar.gz"
113-
name: macOS_64
113+
artifact-name: macOS_64
114114
- task: macOS_ARM64
115115
path: "*macOS_ARM64.tar.gz"
116-
name: macOS_ARM64
116+
artifact-name: macOS_ARM64
117117

118118
steps:
119119
- name: Checkout repository
@@ -141,7 +141,7 @@ jobs:
141141
uses: actions/upload-artifact@v3
142142
with:
143143
path: ${{ env.DIST_DIR }}/${{ matrix.os.path }}
144-
name: ${{ matrix.os.name }}
144+
name: ${{ matrix.os.artifact-name }}
145145

146146
checksums:
147147
needs:

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

+13-13
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
strategy:
2828
matrix:
29-
os:
29+
task:
3030
- Windows_32bit
3131
- Windows_64bit
3232
- Linux_32bit
@@ -45,7 +45,7 @@ jobs:
4545

4646
- name: Create changelog
4747
# Avoid creating the same changelog for each os
48-
if: matrix.os == 'Windows_32bit'
48+
if: matrix.task == 'Windows_32bit'
4949
uses: arduino/create-changelog@v1
5050
with:
5151
tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+.*$'
@@ -65,7 +65,7 @@ jobs:
6565
version: 3.x
6666

6767
- name: Build
68-
run: task dist:${{ matrix.os }}
68+
run: task dist:${{ matrix.task }}
6969

7070
- name: Upload artifacts
7171
uses: actions/upload-artifact@v3
@@ -75,7 +75,7 @@ jobs:
7575
path: ${{ env.DIST_DIR }}
7676

7777
notarize-macos:
78-
name: Notarize ${{ matrix.artifact.name }}
78+
name: Notarize ${{ matrix.build.folder-suffix }}
7979
runs-on: macos-latest
8080
needs: create-release-artifacts
8181
permissions:
@@ -86,11 +86,11 @@ jobs:
8686

8787
strategy:
8888
matrix:
89-
artifact:
90-
- name: darwin_amd64
91-
path: "macOS_64bit.tar.gz"
92-
- name: darwin_arm64
93-
path: "macOS_ARM64.tar.gz"
89+
build:
90+
- folder-suffix: darwin_amd64
91+
package-suffix: "macOS_64bit.tar.gz"
92+
- folder-suffix: darwin_arm64
93+
package-suffix: "macOS_ARM64.tar.gz"
9494

9595
steps:
9696
- name: Checkout repository
@@ -136,7 +136,7 @@ jobs:
136136
run: |
137137
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
138138
# See: https://github.com/Bearer/gon#configuration-file
139-
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"]
139+
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/${{ env.PROJECT_NAME }}"]
140140
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
141141
142142
sign {
@@ -165,11 +165,11 @@ jobs:
165165
run: |
166166
# GitHub's upload/download-artifact actions don't preserve file permissions,
167167
# so we need to add execution permission back until the action is made to do this.
168-
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"
168+
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/${{ env.PROJECT_NAME }}"
169169
TAG="${GITHUB_REF/refs\/tags\//}"
170-
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.artifact.path }}"
170+
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}"
171171
tar -czvf "$PACKAGE_FILENAME" \
172-
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
172+
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}/" "${{ env.PROJECT_NAME }}" \
173173
-C ../../ LICENSE.txt
174174
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
175175

0 commit comments

Comments
 (0)