Skip to content

Merge pull request #55 from ryotarai/ryotarai/go-1.21 #6

Merge pull request #55 from ryotarai/ryotarai/go-1.21

Merge pull request #55 from ryotarai/ryotarai/go-1.21 #6

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}