2021-12-16 21:03:31 +01:00
|
|
|
name: Make release & publish Docker image
|
2021-12-16 20:03:27 +01:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
|
|
|
|
jobs:
|
2022-01-17 19:40:34 +01:00
|
|
|
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 }}
|
2021-12-16 20:03:27 +01:00
|
|
|
steps:
|
2022-01-17 19:40:34 +01:00
|
|
|
- name: Set up Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
2021-12-16 20:03:27 +01:00
|
|
|
|
2022-01-17 19:40:34 +01:00
|
|
|
- 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 }}
|
2021-12-16 20:03:27 +01:00
|
|
|
|
2022-01-17 19:40:34 +01:00
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
2021-12-16 20:03:27 +01:00
|
|
|
with:
|
2022-01-17 19:40:34 +01:00
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2021-12-16 20:03:27 +01:00
|
|
|
|
2022-01-17 19:40:34 +01:00
|
|
|
- name: Build and push
|
|
|
|
id: docker_build
|
|
|
|
uses: docker/build-push-action@v2
|
2021-12-16 20:03:27 +01:00
|
|
|
with:
|
2022-01-17 19:40:34 +01:00
|
|
|
push: true
|
2022-01-17 19:41:26 +01:00
|
|
|
tags: codetheweb/muse:${{ github.sha }}-${{ matrix.tagged-platform }}
|
2022-01-17 19:40:34 +01:00
|
|
|
platforms: ${{ matrix.build-arch }}
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
2022-02-12 03:13:17 +01:00
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache,mode=min
|
2021-12-16 20:03:27 +01:00
|
|
|
|
2022-01-17 19:40:34 +01:00
|
|
|
combine:
|
|
|
|
name: Combine platform tags
|
2021-12-16 20:03:27 +01:00
|
|
|
runs-on: ubuntu-latest
|
2022-01-17 19:40:34 +01:00
|
|
|
needs: publish
|
2021-12-16 20:03:27 +01:00
|
|
|
steps:
|
2022-01-05 23:24:18 +01:00
|
|
|
- uses: actions/checkout@v1
|
|
|
|
|
2021-12-16 20:03:27 +01:00
|
|
|
- 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: Get tags
|
|
|
|
id: get-tags
|
|
|
|
uses: Surgo/docker-smart-tag-action@v1
|
|
|
|
with:
|
|
|
|
docker_image: codetheweb/muse
|
|
|
|
|
2022-01-17 19:40:34 +01:00
|
|
|
- name: Combine tags
|
2022-01-17 19:41:26 +01:00
|
|
|
run: docker buildx imagetools create $(echo '${{ steps.get-tags.outputs.tag }}' | tr "," "\0" | xargs -0 printf -- '-t %s ') 'codetheweb/muse:${{ github.sha }}-arm64' 'codetheweb/muse:${{ github.sha }}-amd64'
|
2021-12-16 20:03:27 +01:00
|
|
|
|
|
|
|
- name: Update Docker Hub description
|
2021-12-18 19:53:06 +01:00
|
|
|
uses: peter-evans/dockerhub-description@v2.4.3
|
2021-12-16 20:03:27 +01:00
|
|
|
env:
|
|
|
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
DOCKERHUB_REPOSITORY: codetheweb/muse
|
2022-01-17 19:40:34 +01:00
|
|
|
|
|
|
|
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
|
2022-03-12 17:03:53 +01:00
|
|
|
token: ${{ secrets.GH_PAT }}
|