Skip to content

Release

Release #111

Workflow file for this run

name: Release
on:
workflow_run:
workflows:
- Test
types:
- completed
branches:
- main
concurrency:
group: ${{ github.workflow }}
jobs:
tagpr:
# (1) Create a release pull request.
# e.g. https://github.com/masutaka/github-nippou/pull/132
# (2) If the pull request exists, update it.
# (3) If the pull request is merged, create a new git tag.
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
- id: run-tagpr
uses: Songmu/tagpr@3dca11e7c0d68637ee212ddd35acc3d30a7403a4 # v1.5.0
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
outputs:
tagpr-tag: ${{ steps.run-tagpr.outputs.tag }}
release:
# When (3) above, the if condition is satisfied.
# The github-nippou binaries are built and uploaded to GitHub release.
if: needs.tagpr.outputs.tagpr-tag != ''
needs: tagpr
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Setup GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
install-only: true
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
owner: 'masutaka'
repositories: 'homebrew-tap'
- name: Release
run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
pushover:
name: pushover if failure
if: failure()
needs: [release]
uses: ./.github/workflows/pushover.yml
secrets:
PUSHOVER_API_KEY: ${{ secrets.PUSHOVER_API_KEY }}
PUSHOVER_USER_KEY: ${{ secrets.PUSHOVER_USER_KEY }}