-
Notifications
You must be signed in to change notification settings - Fork 7
49 lines (47 loc) · 1.69 KB
/
publish_dev_image.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
name: Publish Dev Image
on:
push:
branches: [ master ]
tags-ignore: [ "**" ]
paths-ignore: [ "**.md" ]
jobs:
publish_dev_image:
name: Publish Dev Image
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ~1.21
id: go
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: pfnet-research
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Snapshots
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --snapshot --rm-dist --debug
# Mimic docker, docker_manifests artifacts in goreleaser here.
# because "goreleaser release --snapshot" does NOT publish any artifact
- name: Publish Snapshot Images
shell: bash
run: |
set -euo pipefail
IMAGES=($(jq -r '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json))
for i in ${IMAGES[@]}; do
docker push $i
done
MANIFEST=$(jq '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json | jq -sr '.[0]' | sed -e "s|-[a-z0-9]\+$||g")
docker manifest create ${MANIFEST} ${IMAGES[@]}
docker manifest push ${MANIFEST}
MANIFEST_LATEST=$(jq '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json | jq -sr '.[0]' | sed -e "s|:.*$||g"):latest
docker manifest create ${MANIFEST_LATEST} ${IMAGES[@]}
docker manifest push ${MANIFEST_LATEST}