-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (38 loc) · 1.14 KB
/
build-and-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Build and Push Docker Image to GitHub Packages
on:
push:
branches:
- main
- 'v*.*.*'
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: heavybullets8
password: ${{ secrets.GHCR_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract version
id: vars
run: |
if [ "${GITHUB_REF_TYPE}" == "tag" ]; then
VERSION=${GITHUB_REF_NAME#refs/tags/v}
else
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/heavybullets8/zfs-scrubber:latest
ghcr.io/heavybullets8/zfs-scrubber:${{ env.VERSION }}