Use self-hosted runner for ARM builds (#477)

This commit is contained in:
Max Isom 2022-01-17 12:40:34 -06:00 committed by GitHub
parent 21c9dee6f8
commit 816485e41d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 125 additions and 68 deletions

View file

@ -3,23 +3,32 @@ name: PR Workflow
on: pull_request_target
jobs:
release:
release-snapshot:
name: Release snapshot
runs-on: ubuntu-latest
strategy:
matrix:
runner-platform:
- ubuntu-latest
- self-hosted
include:
- runner-platform: ubuntu-latest
build-arch: linux/amd64
tagged-platform: amd64
- runner-platform: self-hosted
build-arch: linux/arm64
tagged-platform: arm64
runs-on: ${{ matrix.runner-platform }}
steps:
- name: Set up Buildx
uses: docker/setup-buildx-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-prs-${{ github.sha }}
key: ${{ runner.os }}-buildx-prs-${{ matrix.build-arch }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-prs-
${{ runner.os }}-buildx-prs-${{ matrix.build-arch }}
- name: Login to DockerHub
uses: docker/login-action@v1
@ -32,17 +41,37 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: codetheweb/muse:${{ github.event.pull_request.head.sha }}
tags: codetheweb/muse:${{ github.event.pull_request.head.sha }}-${{ matrix.tagged-platform }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
platforms: ${{ matrix.build-arch }}
combine-and-comment:
name: Combine platform tags and leave comment
runs-on: ubuntu-latest
needs: release-snapshot
steps:
- name: Set up Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Combine tags
run: docker buildx imagetools create -t 'codetheweb/muse:pr-${{ github.event.number }}' -t 'codetheweb/muse:${{ github.event.pull_request.head.sha }}' 'codetheweb/muse:${{ github.event.pull_request.head.sha }}-arm64' 'codetheweb/muse:${{ github.event.pull_request.head.sha }}-amd64'
- name: Create comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: "pr-release"
message: |
#### :package: A new release has been made for this pull request
#### :package: A new release has been made for this pull request.
To play around with this PR, pull `codetheweb/muse:${{ github.event.pull_request.head.sha }}`.
To play around with this PR, pull `codetheweb/muse:pr-${{ github.event.number }}` or `codetheweb/muse:${{ github.event.pull_request.head.sha }}`.
Images are available for x86_64 and ARM64.
> Latest commit: ${{ github.event.pull_request.head.sha }}