Skip to content

Commit

Permalink
fix: simplify release workflow by removing unnecessary steps and upda…
Browse files Browse the repository at this point in the history
…ting actions
  • Loading branch information
naka-gawa committed Nov 28, 2024
1 parent 9eef7ff commit 38cb824
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
name: release

on:
push:
branches:
- "main"
tags:
- "v*.*.*"
pull_request:
types:
- labeled
- "v*"

jobs:
release:
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
permissions:
contents: write # これがないとリリースを作成できない
steps:
- uses: actions/checkout@v4
# チェックアウト
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Changelog を正しく動作させるために必要

# Bump version on merging Pull Requests with specific labels.
# (bump:major,bump:minor,bump:patch)
- id: bumpr
if: "!startsWith(github.ref, 'refs/tags/')"
uses: haya14busa/action-bumpr@v1
# Go をセットアップ
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true

# Update corresponding major and minor tag.
# e.g. Update v1 and v1.2 when releasing v1.2.3
- uses: haya14busa/action-update-semver@v1
if: "!steps.bumpr.outputs.skip"
# リリース
- uses: goreleaser/goreleaser-action@v4
with:
github_token: ${{ secrets.github_token }}
tag: ${{ steps.bumpr.outputs.next_version }}
release-check:
if: github.event.action == 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Post bumpr status comment
uses: haya14busa/action-bumpr@v1
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 自動で生成されるシークレット

0 comments on commit 38cb824

Please sign in to comment.