-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
isolate publish_dev_image job in another workflow executed only when …
…pushed on master
- Loading branch information
Showing
2 changed files
with
47 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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 | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ~1.16 | ||
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} |