From 266a4ab78949a9e05ce0eb0d9200fc0c93f2e693 Mon Sep 17 00:00:00 2001 From: Matthew John Date: Fri, 15 Mar 2024 06:54:00 +0000 Subject: [PATCH 1/2] ci: Add github build workflow to build base and server images Issue #126 --- .github/workflows/build.yml | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7af9eca --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,71 @@ +name: Docker + +# 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*.*.*" + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - image: ${{ github.repository }} + dockerfile: Dockerfile + - image: ${{ github.repository }}-server + dockerfile: Dockerfile.server + + 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@v3 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ matrix.image }} + + # 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@ac9327eae2b366085ac7f6a2d02df8aa8ead720a + with: + context: . + file: ${{ matrix.dockerfile }} + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 3aaf005ad9c47e4e59734354f49f23f96df43bcf Mon Sep 17 00:00:00 2001 From: Matthew John Date: Fri, 15 Mar 2024 06:54:39 +0000 Subject: [PATCH 2/2] ci: Add github workflow to create Github releases for each tag Issue #126 --- .github/workflows/release.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d4d31d8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,15 @@ +name: Create Release + +on: + push: + tags: + - "v*.*.*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Release + uses: softprops/action-gh-release@v1