fix: docker push #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish-bitcoin | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
on: | |
push: | |
tags: | |
- 'v*' | |
pull_request: | |
paths: | |
- 'scripts/bitcoin/**' | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: docker.io | |
# Remove the slash at the end of the username | |
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/bitcoind | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Set up QEMU for multi-architecture support | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# Set up BuildKit Docker container builder to be able to build | |
# multi-platform images and export cache | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Login against a Docker registry | |
# https://github.com/docker/login-action | |
- name: Log into Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set Docker image tag | |
id: set-tag | |
run: | | |
if [[ $GITHUB_REF == refs/pull/* ]]; then | |
echo "TAG=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
elif [[ $GITHUB_REF == refs/tags/* ]]; then | |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
fi | |
# Build and push Docker image with Buildx (don't push on PR) | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: scripts/bitcoin | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.set-tag.outputs.TAG }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |