Skip to content

chore: version v0.2.3 #32

chore: version v0.2.3

chore: version v0.2.3 #32

Workflow file for this run

name: Create and publish a Docker image
on:
workflow_dispatch:
push:
branches: ['main', 'staging']
tags: ['v*']
workflow_run:
workflows: [Releaser]
types:
- completed
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
prepare_checkout:
if: (
github.repository == 'ipfs/someguy'
|| github.event_name == 'workflow_dispatch'
) && (
github.event_name != 'workflow_run'
|| github.event.workflow_run.conclusion == 'success'
)
name: Decide what ref to check out
runs-on: ubuntu-latest
outputs:
ref: ${{ github.event_name != 'workflow_run' && github.ref || steps.releaser.outputs.version }}
steps:
- name: Inspect triggering Releaser workflow run
id: releaser
if: github.event_name == 'workflow_run'
uses: ipdxco/unified-github-workflows/.github/actions/[email protected]
with:
artifacts-url: ${{ github.event.workflow_run.artifacts_url }}
build-and-push-image:
needs: [prepare_checkout]
if: needs.prepare_checkout.outputs.ref != ''
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare_checkout.outputs.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get tags
id: tags
env:
IMAGE_NAME: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
run: |
echo "value<<EOF" >> $GITHUB_OUTPUT
./.github/scripts/get-docker-tags.sh "$(date -u +%F)" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
shell: bash
- name: Build Docker image and publish to Docker Hub
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
context: .
push: true
file: ./Dockerfile
tags: "${{ steps.tags.outputs.value }}"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache to limit growth
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache