From b0d5612b90bddf0fd1ceb8ecea36cce5cfa40e06 Mon Sep 17 00:00:00 2001 From: Kieran Date: Sun, 12 Feb 2023 16:57:22 +0000 Subject: [PATCH] feat: tagged docker build --- .github/workflows/tagged.yml | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/tagged.yml diff --git a/.github/workflows/tagged.yml b/.github/workflows/tagged.yml new file mode 100644 index 0000000..940a089 --- /dev/null +++ b/.github/workflows/tagged.yml @@ -0,0 +1,37 @@ +name: Docker build on tag +env: + DOCKER_CLI_EXPERIMENTAL: enabled + TAG_FMT: "^refs/tags/(((.?[0-9]+){3,4}))$" +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ + - v[0-9]+.[0-9]+.[0-9]+-* +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Set env variables + run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-buildx-action@v1 + - name: Build the Docker image + run: | + docker buildx build \ + -t ghcr.io/${{ github.repository_owner }}/snort:$TAG \ + --cache-from "type=local,src=/tmp/.buildx-cache" \ + --cache-to "type=local,dest=/tmp/.buildx-cache" \ + --platform linux/amd64,linux/arm64 \ + --push .