-
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.
Merge pull request #47 from pfnet-research/tagpr
tagpr based automated release
- Loading branch information
Showing
15 changed files
with
310 additions
and
218 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: release | ||
description: release executables | ||
|
||
inputs: | ||
tag: | ||
description: check out the tag if not empty | ||
default: '' | ||
token: | ||
description: GitHub token | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
name: "checkout tag ${{ inputs.tag }}" | ||
if: "inputs.tag != ''" | ||
with: | ||
ref: refs/tags/${{ inputs.tag }} | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.token }} | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ~1.16 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: pfnet-research | ||
password: ${{ inputs.token }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.token }} |
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
changelog: | ||
exclude: | ||
labels: | ||
- release-note/skip | ||
- tagpr | ||
categories: | ||
- title: "💣 Breaking Changes" | ||
labels: | ||
- release-note/breaking-change | ||
- title: "🚀 Features" | ||
labels: | ||
- release-note/feature | ||
- title: "🐛 Bug Fixes" | ||
labels: | ||
- release-note/bugfix | ||
- title: "📜 Documentation" | ||
labels: | ||
- release-note/document | ||
- title: "🧰 Maintenance" | ||
labels: | ||
- release-note/chore | ||
- title: "🔬 Other Changes" | ||
labels: | ||
- "*" |
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,17 @@ | ||
name: Release By Tagged Manually | ||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
goreleaser: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
- uses: ./.github/actions/release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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} |
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
# | ||
# tagpr workflow | ||
# | ||
name: tagpr | ||
on: | ||
push: | ||
branches: ["master"] | ||
|
||
jobs: | ||
tagpr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: tagpr | ||
name: Tagpr | ||
uses: Songmu/tagpr@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# If tagpr pushed tags, invoke release custom action manually. | ||
# It is because: | ||
# > When you use the repository's GITHUB_TOKEN to perform tasks, | ||
# > events triggered by the GITHUB_TOKEN, with the exception of | ||
# > workflow_dispatch and repository_dispatch, will not create | ||
# > a new workflow run. | ||
# ref: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow | ||
- name: "Release (only when tagged)" | ||
uses: ./.github/actions/release | ||
if: "steps.tagpr.outputs.tag != ''" | ||
with: | ||
tag: ${{ steps.tagpr.outputs.tag }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
Oops, something went wrong.