-
Notifications
You must be signed in to change notification settings - Fork 14
143 lines (142 loc) · 4.88 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Name: release.yaml
# Author: Mathew Fleisch <[email protected]>
# Description: This action will build and push a multi-arch docker container,
# cross compile go-binaries and save as release artifacts,
# and package a helm chart as gh-pages env, when triggered by
# pushing a new git tag (that starts with the letter 'v').
name: Release Bashbot
on:
push:
branches:
- main
paths:
- 'charts/**'
jobs:
release:
name: Release Bashbot
runs-on: ubuntu-latest
steps:
-
name: Checkout Bashbot source
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Install stuff with asdf
uses: asdf-vm/actions/install@v2
with:
tool_versions: |
golang 1.19.4
yq 4.30.6
-
name: Set tag environment variable
run: |
echo "RELEASE_VERSION=$(make version)" >> $GITHUB_ENV
echo "RELEASE_VERSION_NO_V=$(make version)" | sed -e 's/v//g' >> $GITHUB_ENV
-
name: Build go-binaries
run: |
make go-setup
make go-cross-compile
echo "Go-Binaries created: $(ls bin -alF)"
-
name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
-
name: Docker Login
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GIT_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository_owner }}/bashbot:latest
ghcr.io/${{ github.repository_owner }}/bashbot:${{ env.RELEASE_VERSION }}
mathewfleisch/bashbot:latest
mathewfleisch/bashbot:${{ env.RELEASE_VERSION }}
cache-from: type=registry,ref=mathewfleisch/bashbot:latest
cache-to: type=inline
-
name: Build and push root container
id: docker_build_root
uses: docker/build-push-action@v4
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository_owner }}/bashbot:latest-root
ghcr.io/${{ github.repository_owner }}/bashbot:${{ env.RELEASE_VERSION }}-root
mathewfleisch/bashbot:latest-root
mathewfleisch/bashbot:${{ env.RELEASE_VERSION }}-root
cache-from: type=registry,ref=mathewfleisch/bashbot:latest
cache-to: type=inline
build-args: NRUSER=root
-
name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
-
name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GIT_TOKEN }}"
CR_SKIP_EXISTING: true
-
name: Cut Github Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GIT_TOKEN }}
allowUpdates: true
artifacts: "bin/*"
tag: bashbot-${{ env.RELEASE_VERSION }}
-
name: Install Bashbot via asdf from release artifacts
uses: asdf-vm/actions/install@v2
with:
tool_versions: bashbot ${{ env.RELEASE_VERSION_NO_V }}
-
name: Notify Release Channel
env:
BASHBOT_CONFIG_FILEPATH: ./config.yaml
SLACK_CHANNEL: C02A1SH4GLT
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_APP_TOKEN: ${{ secrets.SLACK_APP_TOKEN }}
run: |
cat <<EOF > $BASHBOT_CONFIG_FILEPATH
admins:
- trigger: bashbotrelease
appName: Bashbot Releases
userIds:
- "UP3BBQX34"
privateChannelId: "GPFMM5MD2"
logChannelId: "CPJ1NFPL7"
messages: []
tools: []
dependencies: []
EOF
bashbot version
bashbot send-message \
--channel ${SLACK_CHANNEL} \
--msg "Bashbot <https://github.com/mathew-fleisch/bashbot/releases/tag/bashbot-${{ env.RELEASE_VERSION}}|${{ env.RELEASE_VERSION }}> has been released and multi-arch containers have been pushed to <https://hub.docker.com/r/mathewfleisch/bashbot/tags|docker-hub> and <https://github.com/mathew-fleisch/bashbot/pkgs/container/bashbot|ghcr>!"