-
-
Notifications
You must be signed in to change notification settings - Fork 79
84 lines (72 loc) · 2.55 KB
/
release_containers.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: release_containers
on:
workflow_dispatch:
inputs:
checkout_latest:
description: 'Checkout latest tag'
required: true
type: boolean
default: true
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
release_ghcr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout latest release tag
if: github.event_name == 'workflow_dispatch'
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "TAG_VERSION=$LATEST_TAG" >> $GITHUB_ENV
[[ "${{ inputs.checkout_latest }}" == "true" ]] && git checkout $LATEST_TAG || true
- name: Get push tag version
if: github.event_name == 'push'
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Publish Docker image to GitHub Container Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ github.repository }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
tags: "latest,${{ env.TAG_VERSION }}"
platforms: linux/amd64,linux/arm64
release_docker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout latest release tag
if: github.event_name == 'workflow_dispatch'
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "TAG_VERSION=$LATEST_TAG" >> $GITHUB_ENV
[[ "${{ inputs.checkout_latest }}" == "true" ]] && git checkout $LATEST_TAG || true
- name: Get push tag version
if: github.event_name == 'push'
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Publish Docker image to Docker Container Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ github.repository }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ env.TAG_VERSION }}"
platforms: linux/amd64,linux/arm64
- name: Update Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
repository: ${{ github.repository }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}