-
Notifications
You must be signed in to change notification settings - Fork 5
57 lines (49 loc) · 1.33 KB
/
release.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
46
47
48
49
50
51
52
53
54
55
56
57
name: Build and Release
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
permissions:
packages: write
contents: read
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/${{ github.repository }}
jobs:
build-and-release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set variables
id: prep
run: |-
echo VERSION=$(cat version.txt) >> $GITHUB_ENV
echo RELEASE=v$(cat version.txt) >> $GITHUB_ENV
echo GIT_COMMIT=${GITHUB_SHA:0:7} >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: build
uses: docker/build-push-action@v4
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: Dockerfile
push: true
build-args: |
VERSION=${{ env.VERSION }}
RELEASE=${{ env.RELEASE }}
GIT_COMMIT=${{ env.GIT_COMMIT}}
tags: ${{ env.IMAGE }}:latest,${{ env.IMAGE }}:${{ env.RELEASE }}
cache-from: type=gha
cache-to: type=gha,mode=max