2021-03-24 11:11:50 +01:00
|
|
|
name: Release to Docker Hub
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
name: Release to Docker Hub
|
2022-10-20 10:16:43 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-03-24 11:11:50 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-08-01 19:17:40 +02:00
|
|
|
uses: actions/checkout@v3
|
2021-03-24 11:11:50 +01:00
|
|
|
|
|
|
|
- name: Set up QEMU
|
2022-10-20 10:16:43 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2021-03-24 11:11:50 +01:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2022-10-20 10:16:43 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-03-24 11:11:50 +01:00
|
|
|
|
|
|
|
- name: Login to DockerHub
|
2022-10-20 10:16:43 +02:00
|
|
|
uses: docker/login-action@v2
|
2021-03-24 11:11:50 +01:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
2022-10-20 10:16:43 +02:00
|
|
|
- name: Set raw tag
|
|
|
|
id: get_tag
|
|
|
|
run: |
|
|
|
|
TAG=${{ github.event.release.tag_name }}
|
|
|
|
echo "build_tag=${TAG#v}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Set suffix
|
|
|
|
uses: actions/github-script@v6
|
|
|
|
id: suffix
|
|
|
|
with:
|
|
|
|
result-encoding: string
|
|
|
|
script: |
|
|
|
|
const fullTag = '${{ github.event.release.tag_name }}';
|
|
|
|
if (fullTag.includes('-')) {
|
|
|
|
const [, fullSuffix] = fullTag.split('-');
|
|
|
|
const [suffix] = fullSuffix.split('.');
|
|
|
|
return `-${suffix}`;
|
|
|
|
} else {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
- name: Set Docker tags and labels
|
2021-03-24 11:11:50 +01:00
|
|
|
id: docker_meta
|
2022-10-20 10:16:43 +02:00
|
|
|
uses: docker/metadata-action@v4
|
2021-03-24 11:11:50 +01:00
|
|
|
with:
|
|
|
|
images: dashpay/dashd
|
2021-04-17 22:08:45 +02:00
|
|
|
tags: |
|
2022-10-20 10:16:43 +02:00
|
|
|
type=match,pattern=v(\d+),group=1
|
|
|
|
type=match,pattern=v(\d+.\d+),group=1
|
|
|
|
type=match,pattern=v(\d+.\d+.\d+),group=1
|
|
|
|
type=match,pattern=v(.*),group=1,suffix=
|
2021-04-17 22:08:45 +02:00
|
|
|
flavor: |
|
2022-10-20 10:16:43 +02:00
|
|
|
suffix=${{ steps.suffix.outputs.result }},onlatest=true
|
2021-03-24 11:11:50 +01:00
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
id: docker_build
|
2022-10-20 10:16:43 +02:00
|
|
|
uses: docker/build-push-action@v3
|
2021-03-24 11:11:50 +01:00
|
|
|
with:
|
2022-04-28 18:35:50 +02:00
|
|
|
context: ./contrib/containers/deploy
|
2022-04-04 00:24:06 +02:00
|
|
|
file: ./contrib/containers/deploy/Dockerfile.GitHubActions.Release
|
2021-03-24 11:11:50 +01:00
|
|
|
push: true
|
2024-07-25 23:02:31 +02:00
|
|
|
provenance: mode=max
|
|
|
|
sbom: true
|
2021-03-24 11:11:50 +01:00
|
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
2023-11-24 18:23:10 +01:00
|
|
|
build-args: |
|
|
|
|
TAG=${{ steps.get_tag.outputs.build_tag }}
|
2023-12-06 19:24:12 +01:00
|
|
|
GITHUB_REPOSITORY=${{ github.repository }}
|
2022-04-04 00:24:06 +02:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
platforms: linux/amd64,linux/arm64
|
2021-03-24 11:11:50 +01:00
|
|
|
|
|
|
|
- name: Image digest
|
|
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|