Skip to content

Commit 6ff43c4

Browse files
authored
Merge pull request #200 from per1234/workflow-var-names
Refactor variables in release workflows
2 parents 002b3ab + 0a33cec commit 6ff43c4

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

Diff for: .github/workflows/release-go-task.yml

+20-16
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,13 +77,20 @@ 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:
87+
- name: Set environment variables
88+
run: |
89+
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
90+
echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >> "$GITHUB_ENV"
91+
TAG="${GITHUB_REF/refs\/tags\//}"
92+
echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >> $GITHUB_ENV
93+
8794
- name: Checkout repository
8895
uses: actions/checkout@v4
8996

@@ -127,7 +134,7 @@ jobs:
127134
run: |
128135
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
129136
# See: https://github.com/Bearer/gon#configuration-file
130-
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"]
137+
source = ["${{ env.DIST_DIR }}/${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"]
131138
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
132139
133140
sign {
@@ -156,13 +163,10 @@ jobs:
156163
run: |
157164
# GitHub's upload/download-artifact actions don't preserve file permissions,
158165
# 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 }}"
160-
TAG="${GITHUB_REF/refs\/tags\//}"
161-
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.artifact.path }}"
162-
tar -czvf "$PACKAGE_FILENAME" \
163-
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
166+
chmod +x "${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"
167+
tar -czvf "${{ env.PACKAGE_FILENAME }}" \
168+
-C "${{ env.BUILD_FOLDER }}/" "${{ env.PROJECT_NAME }}" \
164169
-C ../../ LICENSE.txt
165-
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
166170
167171
- name: Upload artifact
168172
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)