Skip to content

Commit

Permalink
Merge pull request #200 from per1234/workflow-var-names
Browse files Browse the repository at this point in the history
Refactor variables in release workflows
  • Loading branch information
per1234 authored Nov 7, 2024
2 parents 002b3ab + 0a33cec commit 6ff43c4
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions .github/workflows/release-go-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

strategy:
matrix:
os:
task:
- Windows_32bit
- Windows_64bit
- Linux_32bit
Expand All @@ -40,7 +40,7 @@ jobs:

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

- name: Build
run: task dist:${{ matrix.os }}
run: task dist:${{ matrix.task }}

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

notarize-macos:
name: Notarize ${{ matrix.artifact.name }}
name: Notarize ${{ matrix.build.folder-suffix }}
runs-on: macos-latest
needs: create-release-artifacts
outputs:
Expand All @@ -77,13 +77,20 @@ jobs:

strategy:
matrix:
artifact:
- name: darwin_amd64
path: "macOS_64bit.tar.gz"
- name: darwin_arm64
path: "macOS_ARM64.tar.gz"
build:
- folder-suffix: darwin_amd64
package-suffix: "macOS_64bit.tar.gz"
- folder-suffix: darwin_arm64
package-suffix: "macOS_ARM64.tar.gz"

steps:
- name: Set environment variables
run: |
# See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >> "$GITHUB_ENV"
TAG="${GITHUB_REF/refs\/tags\//}"
echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4

Expand Down Expand Up @@ -127,7 +134,7 @@ jobs:
run: |
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
# See: https://github.com/Bearer/gon#configuration-file
source = ["${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"]
source = ["${{ env.DIST_DIR }}/${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"]
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
sign {
Expand Down Expand Up @@ -156,13 +163,10 @@ jobs:
run: |
# GitHub's upload/download-artifact actions don't preserve file permissions,
# so we need to add execution permission back until the action is made to do this.
chmod +x "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/${{ env.PROJECT_NAME }}"
TAG="${GITHUB_REF/refs\/tags\//}"
PACKAGE_FILENAME="${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.artifact.path }}"
tar -czvf "$PACKAGE_FILENAME" \
-C "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}/" "${{ env.PROJECT_NAME }}" \
chmod +x "${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"
tar -czvf "${{ env.PACKAGE_FILENAME }}" \
-C "${{ env.BUILD_FOLDER }}/" "${{ env.PROJECT_NAME }}" \
-C ../../ LICENSE.txt
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit 6ff43c4

Please sign in to comment.