From 962fa9a65c42eb0045caf47b15d738a4933b2101 Mon Sep 17 00:00:00 2001 From: Antonin Stefanutti Date: Tue, 14 Feb 2023 11:57:37 +0100 Subject: [PATCH] ci: Add container image workflow --- .github/workflows/image.yml | 75 +++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/image.yml diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 0000000..494ed6d --- /dev/null +++ b/.github/workflows/image.yml @@ -0,0 +1,75 @@ +name: image + +permissions: + packages: write + +on: + push: + branches: + - master + tags: + - 'v*' + paths-ignore: + - 'docs/**' + - '**.adoc' + - '**.md' + - 'LICENSE' + pull_request: + branches: + - master + paths-ignore: + - 'docs/**' + - '**.adoc' + - '**.md' + - 'LICENSE' + +jobs: + buildx: + if: github.repository_owner == 'astefanutti' + name: buildx + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/${{ github.repository_owner }}/decktape + tags: | + type=ref,event=branch + type=raw,value=latest,enable={{is_default_branch}} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + cache-from: type=gha,scope=${{ github.ref_name }} + cache-to: type=gha,scope=${{ github.ref_name }},mode=max + provenance: false