-
Notifications
You must be signed in to change notification settings - Fork 4
49 lines (46 loc) · 1.49 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
41
42
43
44
45
46
47
48
49
name: publish docker image
on:
push:
tags:
- "*"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
args: release --rm-dist
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- name: Login to Appclacks Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build/Push image appclacks/cabourotte:latest
shell: /usr/bin/bash {0}
run: |
docker build . -t appclacks/cabourotte:latest
docker push appclacks/cabourotte:latest
# get tags of current commit
tag=$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))
if [ ! -z "$tag" ]; then
echo "Tag name from git describe: $tag"
docker tag appclacks/cabourotte:latest appclacks/cabourotte:$tag
docker push appclacks/cabourotte:$tag
fi