aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2022-01-17 12:40:34 -0600
committerGitHub <[email protected]>2022-01-17 12:40:34 -0600
commit816485e41de2cb3bce515c95753231b94aa0d107 (patch)
tree4ad31f0401dfb97f7861b8d94c1fbf5c39104890 /.github
parent21c9dee6f856edf20d4f33f49f3f20d815be92d1 (diff)
downloadmuse-816485e41de2cb3bce515c95753231b94aa0d107.tar.xz
muse-816485e41de2cb3bce515c95753231b94aa0d107.zip
Use self-hosted runner for ARM builds (#477)
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--.github/workflows/pr.yml49
-rw-r--r--.github/workflows/publish.yml114
3 files changed, 111 insertions, 54 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ffea6a0..5eea299 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,6 +1,6 @@
name: Lint & build
-on: [push, pull_request]
+on: push
jobs:
build:
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 2a7a117..02eb197 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -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:pr-${{ github.event.number }}` or `codetheweb/muse:${{ github.event.pull_request.head.sha }}`.
- To play around with this PR, pull `codetheweb/muse:${{ github.event.pull_request.head.sha }}`.
+ Images are available for x86_64 and ARM64.
> Latest commit: ${{ github.event.pull_request.head.sha }}
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 9b8fd9e..821178e 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -6,54 +6,58 @@ on:
- 'v*'
jobs:
- release:
- runs-on: ubuntu-latest
+ publish:
+ 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:
- - uses: actions/checkout@v2
+ - name: Set up Buildx
+ uses: docker/setup-buildx-action@v1
- - name: Get version from tag
- id: tag_name
- run: |
- echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
- shell: bash
+ - name: Cache Docker layers
+ uses: actions/cache@v2
+ with:
+ path: /tmp/.buildx-cache
+ key: ${{ runner.os }}-buildx-prs-${{ matrix.build-arch }}-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-buildx-prs-${{ matrix.build-arch }}
- - name: Get Changelog Entry
- id: changelog_reader
- uses: mindsers/changelog-reader-action@v2
+ - name: Login to DockerHub
+ uses: docker/login-action@v1
with:
- version: ${{ steps.tag_name.outputs.current_version }}
- path: ./CHANGELOG.md
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
- - name: Create/update release
- uses: ncipollo/release-action@v1
+ - name: Build and push
+ id: docker_build
+ uses: docker/build-push-action@v2
with:
- tag: v${{ steps.changelog_reader.outputs.version }}
- name: Release v${{ steps.changelog_reader.outputs.version }}
- body: ${{ steps.changelog_reader.outputs.changes }}
- prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
- draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
- allowUpdates: true
- token: ${{ secrets.GITHUB_TOKEN }}
+ push: true
+ tags: codetheweb/muse:${{ github.event.pull_request.head.sha }}-${{ matrix.tagged-platform }}
+ platforms: ${{ matrix.build-arch }}
+ cache-from: type=local,src=/tmp/.buildx-cache
+ cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
- publish:
+ combine:
+ name: Combine platform tags
runs-on: ubuntu-latest
+ needs: publish
steps:
- uses: actions/checkout@v1
- 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-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-buildx-
-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
@@ -74,15 +78,8 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- - name: Build and push
- id: docker_build
- uses: docker/build-push-action@v2
- with:
- push: true
- tags: ${{ steps.get-tags.outputs.tag }}
- platforms: linux/amd64,linux/arm64
- cache-from: type=local,src=/tmp/.buildx-cache
- cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
+ - name: Combine tags
+ run: docker buildx imagetools create $(echo '${{ steps.get-tags.outputs.tag }}' | tr "," "\0" | xargs -0 printf -- '-t %s ') 'codetheweb/muse:${{ github.event.pull_request.head.sha }}-arm64' 'codetheweb/muse:${{ github.event.pull_request.head.sha }}-amd64'
- name: Update Docker Hub description
uses: peter-evans/[email protected]
@@ -90,3 +87,34 @@ jobs:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_REPOSITORY: codetheweb/muse
+
+ release:
+ name: Create GitHub release
+ runs-on: ubuntu-latest
+ needs: combine
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Get version from tag
+ id: tag_name
+ run: |
+ echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
+ shell: bash
+
+ - name: Get Changelog Entry
+ id: changelog_reader
+ uses: mindsers/changelog-reader-action@v2
+ with:
+ version: ${{ steps.tag_name.outputs.current_version }}
+ path: ./CHANGELOG.md
+
+ - name: Create/update release
+ uses: ncipollo/release-action@v1
+ with:
+ tag: v${{ steps.changelog_reader.outputs.version }}
+ name: Release v${{ steps.changelog_reader.outputs.version }}
+ body: ${{ steps.changelog_reader.outputs.changes }}
+ prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
+ draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
+ allowUpdates: true
+ token: ${{ secrets.GITHUB_TOKEN }}