-
-
Notifications
You must be signed in to change notification settings - Fork 20
46 lines (39 loc) · 1.34 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
name: Docker Release Tag
on:
push:
tags: ["v*.*.*"]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag from release name
id: extract_tag
run: |
echo "tag=$(echo $GITHUB_REF | sed 's|refs/tags/v||')" >> $GITHUB_OUTPUT
- name: Tag and Push Image
run: |
export IMAGE_NAME=$(echo "$IMAGE_NAME" | awk '{print tolower($0)}')
echo $IMAGE_NAME
env
echo ${{ env.REGISTRY }}/$IMAGE_NAME:master
docker pull ${{ env.REGISTRY }}/$IMAGE_NAME:master
docker tag ${{ env.REGISTRY }}/$IMAGE_NAME:master ${{ env.REGISTRY }}/$IMAGE_NAME:${{ steps.extract_tag.outputs.tag }}
docker push ${{ env.REGISTRY }}/$IMAGE_NAME:${{ steps.extract_tag.outputs.tag }}