Skip to content
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

Bump actions/upload-artifact from 3 to 4 #76

Merged
merged 8 commits into from
Oct 18, 2024
2 changes: 1 addition & 1 deletion .github/workflows/check-go-dependencies-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
# Some might find it convenient to have CI generate the cache rather than setting up for it locally
- name: Upload cache to workflow artifact
if: failure() && steps.diff.outcome == 'failure'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
include-hidden-files: true
Expand Down
87 changes: 54 additions & 33 deletions .github/workflows/release-go-crosscompile-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
DIST_DIR: dist
# The project's folder on Arduino's download server for uploading builds
AWS_PLUGIN_TARGET: /arduinoOTA/
ARTIFACT_NAME: dist
ARTIFACT_PREFIX: dist-
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
GO_VERSION: "1.17"

Expand All @@ -24,15 +24,24 @@ jobs:
strategy:
matrix:
os:
- Windows_32bit
- Windows_64bit
- Linux_32bit
- Linux_64bit
- Linux_ARMv6
- Linux_ARMv7
- Linux_ARM64
- macOS_64bit
- macOS_ARM64
- task: Windows_32bit
artifact-suffix: Windows_32bit
- task: Windows_64bit
artifact-suffix: Windows_64bit
- task: Linux_32bit
artifact-suffix: Linux_32bit
- task: Linux_64bit
artifact-suffix: Linux_64bit
- task: Linux_ARMv6
artifact-suffix: Linux_ARMv6
- task: Linux_ARMv7
artifact-suffix: Linux_ARMv7
- task: Linux_ARM64
artifact-suffix: Linux_ARM64
- task: macOS_64bit
artifact-suffix: macOS_64bit
- task: macOS_ARM64
artifact-suffix: macOS_ARM64

steps:
- name: Checkout repository
Expand All @@ -42,7 +51,7 @@ jobs:

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

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

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ env.ARTIFACT_NAME }}
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.os.artifact-suffix }}
path: ${{ env.DIST_DIR }}

notarize-macos:
name: Notarize ${{ matrix.artifact.name }}
name: Notarize ${{ matrix.build.artifact-suffix }}
runs-on: macos-latest
needs: create-release-artifacts
outputs:
Expand All @@ -84,22 +93,36 @@ jobs:

strategy:
matrix:
artifact:
- name: darwin_amd64
path: "macOS_64bit.tar.gz"
- name: darwin_arm64
path: "macOS_ARM64.tar.gz"
build:
- artifact-suffix: macOS_64bit
folder-suffix: darwin_amd64
package-suffix: "macOS_64bit.tar.gz"
- artifact-suffix: macOS_ARM64
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

- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
path: ${{ env.DIST_DIR }}

- name: Remove non-notarized artifact
uses: geekyeggo/delete-artifact@v5
with:
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}

- name: Import Code-Signing Certificates
env:
KEYCHAIN: "sign.keychain"
Expand Down Expand Up @@ -133,7 +156,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 @@ -162,17 +185,14 @@ 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" "${{ env.PROJECT_NAME }}_osx_${{ matrix.artifact.name }}"
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV
chmod +x "${{ env.BUILD_FOLDER }}/${{ env.PROJECT_NAME }}"
tar -czvf "${{ env.PACKAGE_FILENAME }}" "${{ env.BUILD_FOLDER }}/"

- name: Upload artifact
uses: actions/upload-artifact@v3
- name: Upload notarized artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ env.ARTIFACT_NAME }}
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
path: ${{ env.DIST_DIR }}/${{ env.PACKAGE_FILENAME }}

create-release:
Expand All @@ -181,10 +201,11 @@ jobs:

steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
merge-multiple: true
path: ${{ env.DIST_DIR }}
pattern: ${{ env.ARTIFACT_PREFIX }}*

- name: Create checksum file
working-directory: ${{ env.DIST_DIR}}
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/sync-labels-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 16.x
CONFIGURATIONS_FOLDER: .github/label-configuration-files
CONFIGURATIONS_ARTIFACT: label-configuration-files
CONFIGURATIONS_ARTIFACT_PREFIX: label-configuration-file-

# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
on:
Expand Down Expand Up @@ -81,13 +81,13 @@ jobs:
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }}

- name: Pass configuration files to next job via workflow artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: |
*.yaml
*.yml
if-no-files-found: error
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}${{ matrix.filename }}

sync:
needs: download
Expand Down Expand Up @@ -118,16 +118,17 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download configuration files artifact
uses: actions/download-artifact@v3
- name: Download configuration file artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
merge-multiple: true
pattern: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}*
path: ${{ env.CONFIGURATIONS_FOLDER }}

- name: Remove unneeded artifact
uses: geekyeggo/delete-artifact@v2
- name: Remove unneeded artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}*

- name: Setup Node.js
uses: actions/setup-node@v4
Expand Down
Loading