Skip to content

Commit b42b826

Browse files
authored
Merge pull request #66 from per1234/workflow-env-vars
Refactor variables in release workflow
2 parents 517dcc5 + 9db57ba commit b42b826

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

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

Lines changed: 16 additions & 12 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,13 +74,20 @@ 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:
84+
- name: Set environment variables
85+
run: |
86+
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
87+
echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >> "$GITHUB_ENV"
88+
TAG="${GITHUB_REF/refs\/tags\//}"
89+
echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >> $GITHUB_ENV
90+
8491
- name: Checkout repository
8592
uses: actions/checkout@v4
8693

@@ -124,7 +131,7 @@ jobs:
124131
run: |
125132
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
126133
# See: https://github.com/Bearer/gon#configuration-file
127-
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"]
134+
source = ["${{ env.DIST_DIR }}/${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"]
128135
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
129136
130137
sign {
@@ -154,11 +161,8 @@ jobs:
154161
run: |
155162
# GitHub's upload/download-artifact actions don't preserve file permissions,
156163
# 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 }}"
158-
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 }}"
161-
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
164+
chmod +x "${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"
165+
tar -czvf "${{ env.PACKAGE_FILENAME }}" "${{ env.BUILD_FOLDER }}"
162166
163167
- name: Upload artifact
164168
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)