-
Notifications
You must be signed in to change notification settings - Fork 16
98 lines (78 loc) · 3.1 KB
/
release.yaml
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Release Semaphore
on:
push:
tags:
- v*
jobs:
push:
name: Publish docker images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Format version
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo VERSION=$VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build image
run: docker build --file Dockerfile --build-arg version=v${VERSION} --build-arg build=$(git rev-parse --short HEAD) --build-arg label=release --tag semaphore .
- name: Log into Docker hub
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
- name: Push image Docker hub
run: |
IMAGE_ID=jxapp/semaphore
echo IMAGE_ID=$IMAGE_ID:$VERSION
docker tag semaphore $IMAGE_ID:$VERSION
docker tag semaphore $IMAGE_ID:latest
docker push $IMAGE_ID:$VERSION
docker push $IMAGE_ID:latest
- name: Log into Github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Push image Github registry
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/server
echo IMAGE_ID=$IMAGE_ID:$VERSION
docker tag semaphore $IMAGE_ID:$VERSION
docker tag semaphore $IMAGE_ID:latest
docker push $IMAGE_ID:$VERSION
docker push $IMAGE_ID:latest
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Format version
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo VERSION=$VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Discord notification
uses: appleboy/discord-action@master
with:
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
file: "./dist/semaphore.rb"
message: "A new Homebrew formula is available for version v${{ env.VERSION }}"