Skip to content

Commit b0d5612

Browse files
committed
feat: tagged docker build
1 parent f207c45 commit b0d5612

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/tagged.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Docker build on tag
2+
env:
3+
DOCKER_CLI_EXPERIMENTAL: enabled
4+
TAG_FMT: "^refs/tags/(((.?[0-9]+){3,4}))$"
5+
on:
6+
push:
7+
tags:
8+
- v[0-9]+.[0-9]+.[0-9]+
9+
- v[0-9]+.[0-9]+.[0-9]+-*
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Set env variables
15+
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
16+
- uses: actions/checkout@v2
17+
- uses: actions/cache@v2
18+
with:
19+
path: /tmp/.buildx-cache
20+
key: ${{ runner.os }}-buildx-${{ github.sha }}
21+
restore-keys: |
22+
${{ runner.os }}-buildx-
23+
- uses: docker/login-action@v1
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.repository_owner }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
- uses: docker/setup-qemu-action@v1
29+
- uses: docker/setup-buildx-action@v1
30+
- name: Build the Docker image
31+
run: |
32+
docker buildx build \
33+
-t ghcr.io/${{ github.repository_owner }}/snort:$TAG \
34+
--cache-from "type=local,src=/tmp/.buildx-cache" \
35+
--cache-to "type=local,dest=/tmp/.buildx-cache" \
36+
--platform linux/amd64,linux/arm64 \
37+
--push .

0 commit comments

Comments
 (0)