Replace existing worflow with publish-on-tag

This commit is contained in:
nmfretz 2024-09-10 15:44:09 +10:00
parent b80f59ad57
commit 182a86195f
2 changed files with 42 additions and 65 deletions

View File

@ -1,65 +0,0 @@
name: Docker CI
on:
push:
branches:
- master
env:
LATEST_TAG: 24.0.1
jobs:
build:
name: Build and push to Docker Hub
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
version:
- "24.0.1"
- "23.1"
- "23.0"
- "22.1"
- "22.0"
- "0.21.2"
- "0.21.1"
- "0.21.0"
- "0.20.2"
- "0.20.1"
- "0.20.0"
- "0.19.1"
- "0.19.0.1"
- "0.18.1"
- "0.18.0"
- "0.17.2"
- "0.17.1"
- "0.17.0.1"
- "0.17.0"
- "0.16.3"
- "0.15.2"
- "0.14.3"
- "0.13.2"
- "0.13.1"
- "0.13.0"
steps:
- uses: actions/checkout@v1
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Setup Docker buildx
run: docker buildx create --use
- name: Run Docker buildx
run: |
docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--build-arg VERSION=${{matrix.version}} \
--tag ${{ secrets.DOCKER_USERNAME }}/bitcoind:v${{matrix.version}} \
--push .
- name: Rebuild for latest tag
if: matrix.version == env.LATEST_TAG
run: |
docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--build-arg VERSION=${{matrix.version}} \
--tag ${{ secrets.DOCKER_USERNAME }}/bitcoind:latest \
--push .

42
.github/workflows/publish-on-tag.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Publish Docker image on tag
on:
push:
tags:
- 'v*'
jobs:
push_to_dockerhub:
name: Push Docker image to Docker Hub
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract metadata
id: meta
run: |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: getumbrel/bitcoind:${{ steps.meta.outputs.TAG }}
build-args: |
VERSION=${{ steps.meta.outputs.VERSION }}