-
Notifications
You must be signed in to change notification settings - Fork 129
40 lines (40 loc) · 1.1 KB
/
publish.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
name: Publish
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
inputs:
git_tag:
required: true
type: string
env:
GIT_TAG: ${{ github.event.inputs.git_tag || github.ref_name }}
jobs:
publish:
runs-on: ubuntu-22.04
steps:
- name: Checkout specified tag
uses: actions/checkout@v3
with:
ref: ${{ env.GIT_TAG }}
- name: Create version tag for Docker image
run: |
echo "BUILD_VERSION=$(echo ${GIT_TAG} | sed 's/^v//')" >> $GITHUB_ENV
- name: Create empty token file
run: |
touch token.txt
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push tagged Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.BUILD_VERSION }}