From 26f486594fc8d74f41d50394fa52326c8feed8df Mon Sep 17 00:00:00 2001 From: Warren Snipes Date: Wed, 26 Feb 2025 11:17:44 -0500 Subject: [PATCH] support arm via arm github-hosted runner --- .github/workflows/release.yaml | 41 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 673bdf9..a6aed41 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,14 +12,18 @@ on: description: "Version Number (semver: 1.2.3)" required: true type: string + env: - # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io - # github.repository as / IMAGE_NAME: ${{ github.repository }} + jobs: build: - runs-on: ubuntu-latest + strategy: + matrix: + platform: [ "linux/amd64", "linux/arm64" ] + # Use GitHub-hosted runner for amd64 and the arm64 partner runner for arm64 + runs-on: ${{ matrix.platform == 'linux/arm64' && 'arm-ubuntu-24' || 'ubuntu-latest' }} permissions: contents: read packages: write @@ -27,29 +31,25 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + # We don't need QEMU since we're running on native hardware. - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - #Login against a Docker registry except on PR - #https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Generate build ID id: prep run: | branch=${GITHUB_REF##*/} sha=${GITHUB_SHA::8} ts=$(date +%s) - echo "::set-output name=BUILD_ID::${branch}-${sha}-${ts}" + echo "BUILD_ID=${branch}-${sha}-${ts}" >> $GITHUB_OUTPUT - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 @@ -59,24 +59,23 @@ jobs: type=raw,value=latest type=raw,value=${{ steps.prep.outputs.BUILD_ID }} type=raw,value=${{ inputs.version }} - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - - name: Build and push Docker image + + - name: Build and push Docker image for ${{ matrix.platform }} uses: docker/build-push-action@v6 with: context: . push: true - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + release: - needs: - - build + needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: "marvinpinto/action-automatic-releases@latest" + - uses: marvinpinto/action-automatic-releases@latest with: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: ${{ inputs.version }} @@ -87,8 +86,7 @@ jobs: permissions: pull-requests: write contents: write - needs: - - release + needs: release runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -100,6 +98,7 @@ jobs: run: | git config user.name "GitHub Actions" git config user.email noreply@github.com + - name: Update Changelog uses: thomaseizinger/keep-a-changelog-new-release@v3 with: @@ -110,11 +109,12 @@ jobs: run: | git add CHANGELOG.md git commit --message "Prepare release ${{ inputs.version }}" - echo "::set-output name=commit::$(git rev-parse HEAD)" + echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Push commit run: | git push origin release/${{ inputs.version }} + - name: Create pull request into main uses: thomaseizinger/create-pull-request@1.4.0 with: @@ -126,6 +126,7 @@ jobs: body: | This PR was created when the Create Release workflow was run. I've updated the version name and code commit: ${{ steps.make-commit.outputs.commit }}. + - name: Create pull request into development uses: thomaseizinger/create-pull-request@1.4.0 with: