blob: 54dcdc4df4548bc4839d7589331f523e00c3f80e (
plain)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
name: Deploy Released Assets
on:
release:
types: [published]
permissions:
contents: write
pull-requests: write
packages: write
jobs:
deploy-alpine:
runs-on: ubuntu-latest
environment:
name: aports
env:
TAG_NAME: ${{ github.event.release.tag_name }}
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: install lab
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh release download --repo zaquestion/lab v0.25.1 -p lab_0.25.1_linux_amd64.tar.gz
tar -xzf lab_0.25.1_linux_amd64.tar.gz
./lab --version
- uses: actions/checkout@v4
- name: Retrieve release artifacts
id: artifacts
run: |
# need the checksums
gh release download ${TAG_NAME} --skip-existing -p "${TAG_NAME}.sha*"
echo "sha256sum=$(cat ${TAG_NAME}.sha256)" >> $GITHUB_OUTPUT
echo "sha512sum=$(cat ${TAG_NAME}.sha512)" >> $GITHUB_OUTPUT
# need gomplate to template the APKBUILD!
gh release download ${TAG_NAME} --skip-existing -p gomplate_linux-amd64
chmod 755 gomplate_linux-amd64
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: checkout alpinelinux/aports
run: |
set -ex
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git clone -v https://gitlab.alpinelinux.org/hairyhenderson/aports.git
cd aports
# note: this token expires, so needs to be rotated periodically
git remote set-url origin "https://oauth2:${{ secrets.GITLAB_ACCESS_TOKEN }}@gitlab.alpinelinux.org/hairyhenderson/aports.git"
git remote add upstream https://gitlab.alpinelinux.org/alpine/aports.git
git checkout master
- name: update fork
run: |
set -ex
cd aports
git fetch -v upstream
git rebase upstream/master
git push
- name: upgrade gomplate in aports
run: |
set -ex
export VERSION=${TAG_NAME#v}
cd aports/community/gomplate
git checkout -b upgrade-gomplate-aport-${VERSION}
export ENVJSON="{\"version\": \"${VERSION}\", \"sha512\": \"${{ steps.artifacts.outputs.sha512sum }}\" }"
../../../gomplate_linux-amd64 -c .=env:///ENVJSON\?type=application/json \
-f ../../../packaging/alpine/APKBUILD.tmpl \
-o APKBUILD
git add APKBUILD
git commit -sm "community/gomplate: upgrade to ${VERSION}"
git push -u origin upgrade-gomplate-aport-${VERSION}
# open a PR
../../../lab mr create --allow-collaboration \
-m "community/gomplate: upgrade to ${VERSION}" \
-m "https://github.com/${{ github.repository }}/releases/tag/${TAG_NAME}"
deploy-homebrew:
# run on macOS - this doesn't work in Linuxbrew
runs-on: macos-latest
environment:
name: homebrew
env:
TAG_NAME: ${{ github.event.release.tag_name }}
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Bump packages
uses: Homebrew/actions/bump-packages@master
with:
token: ${{ steps.app-token.outputs.token }}
formulae: gomplate
fork: true
deploy-docker:
runs-on: ubuntu-latest
env:
TAG_NAME: ${{ github.event.release.tag_name }}
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.4.0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.9.0
with:
version: v0.19.3
driver-opts: |
image=moby/buildkit:buildx-stable-1
network=host
- name: Available platforms
run: echo {{ `${{ steps.buildx.outputs.platforms }}` }}
- run: docker info && docker version
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Login to GHCR
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ steps.app-token.outputs.token }}
- name: Login to DockerHub
uses: docker/login-action@v3.3.0
with:
# NOTE: DOCKERHUB_TOKEN and DOCKERHUB_USERNAME must be present in https://github.com/hairyhenderson/gomplate/settings
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Push
run: |
set -ex
# seed from the last ghcr.io image(s)
docker pull ghcr.io/hairyhenderson/gomplate:latest
docker pull ghcr.io/hairyhenderson/gomplate:alpine
export srcrepo=ghcr.io/${{ github.repository}}
export COMMIT=${{ github.sha }}
make docker-multi COMMIT=${COMMIT} DOCKER_REPO=${srcrepo} BUILDX_ACTION=--push
set -x
export repo=${srcrepo}
export git_tag=${TAG_NAME}
export major_version=${git_tag%\.*}
docker buildx imagetools create -t ${repo}:stable ${srcrepo}:latest
docker buildx imagetools create -t ${repo}:${git_tag} ${srcrepo}:latest
docker buildx imagetools create -t ${repo}:${major_version} ${srcrepo}:latest
docker buildx imagetools create -t ${repo}:stable-alpine ${srcrepo}:alpine
docker buildx imagetools create -t ${repo}:${git_tag}-alpine ${srcrepo}:alpine
docker buildx imagetools create -t ${repo}:${major_version}-alpine ${srcrepo}:alpine
# and now DockerHub (if we don't get rate-limited)
export repo=gomplate/gomplate
docker buildx imagetools create -t ${repo}:stable ${srcrepo}:latest
docker buildx imagetools create -t ${repo}:${git_tag} ${srcrepo}:latest
docker buildx imagetools create -t ${repo}:${major_version} ${srcrepo}:latest
docker buildx imagetools create -t ${repo}:stable-alpine ${srcrepo}:alpine
docker buildx imagetools create -t ${repo}:${git_tag}-alpine ${srcrepo}:alpine
docker buildx imagetools create -t ${repo}:${major_version}-alpine ${srcrepo}:alpine
export repo=hairyhenderon/gomplate
docker buildx imagetools create -t ${repo}:stable ${srcrepo}:latest
docker buildx imagetools create -t ${repo}:${git_tag} ${srcrepo}:latest
docker buildx imagetools create -t ${repo}:${major_version} ${srcrepo}:latest
docker buildx imagetools create -t ${repo}:stable-alpine ${srcrepo}:alpine
docker buildx imagetools create -t ${repo}:${git_tag}-alpine ${srcrepo}:alpine
docker buildx imagetools create -t ${repo}:${major_version}-alpine ${srcrepo}:alpine
|