From 5a11117deaace6c14b2928f69d479aeb270c571f Mon Sep 17 00:00:00 2001 From: Michael Schmitz Date: Sun, 16 Oct 2022 16:35:09 +0200 Subject: [PATCH] Add CI --- .github/workflows/build.yml | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 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..4d3ad83 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,63 @@ +--- +name: ci + +on: + schedule: + - cron: "0 4 * * 0" + workflow_dispatch: + pull_request: + branches: + - 'master' + push: + branches: + - master + - unicorn + tags: + - 'v*' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: set up qemu + uses: docker/setup-qemu-action@v2 + + - name: set up docker buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64,linux/arm64 + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}