-
Notifications
You must be signed in to change notification settings - Fork 74
74 lines (59 loc) · 1.8 KB
/
Copy pathrelease-docker.yaml
File metadata and controls
74 lines (59 loc) · 1.8 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Release(docker)
on:
push:
tags:
- "v*.*.*"
branches-ignore:
- "renovate/**"
permissions:
packages: write
jobs:
docker:
name: "docker"
runs-on: ubuntu-24.04
env:
IMAGE: "ghcr.io/${{ github.repository_owner }}/chii"
steps:
- uses: actions/checkout@v6.0.2
with:
submodules: true
- uses: trim21/actions/setup-go@master
with:
cache-namespace: build
- run: echo "SHA=${GITHUB_REF##*/}" >> $GITHUB_ENV
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
- run: echo "SHA=$(git show --no-patch --no-notes --date=short-local --pretty='%as-%h')" >> $GITHUB_ENV
if: "${{ !startsWith(github.ref, 'refs/tags/') }}"
env:
TZ: UTC
- run: node .github/scripts/write-version.js
- name: Install Task
uses: arduino/setup-task@v2.0.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
- run: task build
name: Build Binary
- name: Docker metadata
id: meta
uses: docker/metadata-action@v6.0.0
with:
images: ${{ env.IMAGE }}
tags: |
type=semver,event=tag,pattern=v{{version}}
type=raw,value={{commit_date 'YYYY-MM-DD'}}-{{sha}}
type=ref,event=branch
type=ref,event=branch,suffix=-${{ env.SHA }}
- uses: docker/login-action@v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build Final Docker Image
uses: docker/build-push-action@v7.1.0
with:
context: ./
provenance: false
file: etc/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}