Skip to content

Refactor variables in release workflows #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/publish-go-tester-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:

build:
needs: package-name-prefix
name: Build ${{ matrix.os.name }}
name: Build ${{ matrix.os.artifact-name }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -89,31 +89,31 @@ jobs:
os:
- task: Windows_32bit
path: "*Windows_32bit.zip"
name: Windows_X86-32
artifact-name: Windows_X86-32
- task: Windows_64bit
path: "*Windows_64bit.zip"
name: Windows_X86-64
artifact-name: Windows_X86-64
- task: Linux_32bit
path: "*Linux_32bit.tar.gz"
name: Linux_X86-32
artifact-name: Linux_X86-32
- task: Linux_64bit
path: "*Linux_64bit.tar.gz"
name: Linux_X86-64
artifact-name: Linux_X86-64
- task: Linux_ARMv6
path: "*Linux_ARMv6.tar.gz"
name: Linux_ARMv6
artifact-name: Linux_ARMv6
- task: Linux_ARMv7
path: "*Linux_ARMv7.tar.gz"
name: Linux_ARMv7
artifact-name: Linux_ARMv7
- task: Linux_ARM64
path: "*Linux_ARM64.tar.gz"
name: Linux_ARM64
artifact-name: Linux_ARM64
- task: macOS_64bit
path: "*macOS_64bit.tar.gz"
name: macOS_64
artifact-name: macOS_64
- task: macOS_ARM64
path: "*macOS_ARM64.tar.gz"
name: macOS_ARM64
artifact-name: macOS_ARM64

steps:
- name: Checkout repository
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
path: ${{ env.DIST_DIR }}/${{ matrix.os.path }}
name: ${{ matrix.os.name }}
name: ${{ matrix.os.artifact-name }}

checksums:
needs:
Expand Down
36 changes: 20 additions & 16 deletions .github/workflows/release-go-crosscompile-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

strategy:
matrix:
os:
task:
- Windows_32bit
- Windows_64bit
- Linux_32bit
Expand All @@ -45,7 +45,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 @@ -65,7 +65,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 @@ -75,7 +75,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
permissions:
Expand All @@ -86,13 +86,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 @@ -136,7 +143,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 @@ -165,13 +172,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
Loading