From 745a0bd5d444494d11f5c0daca983bff8f9c3cd1 Mon Sep 17 00:00:00 2001 From: tshion Date: Wed, 4 Jun 2025 22:12:43 +0900 Subject: [PATCH 1/2] =?UTF-8?q?can-release=20=E3=82=92=E8=87=AA=E4=BD=9C?= =?UTF-8?q?=E3=82=A2=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=AB=E5=B7=AE?= =?UTF-8?q?=E3=81=97=E6=9B=BF=E3=81=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/can-release.bash | 13 ------------- .github/workflows/create-release-pr.yml | 9 ++++----- 2 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 .github/scripts/can-release.bash diff --git a/.github/scripts/can-release.bash b/.github/scripts/can-release.bash deleted file mode 100644 index 5bbc771..0000000 --- a/.github/scripts/can-release.bash +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# 引数で指定されたGit タグ名でリリースできるかどうか -# -# $1 -> Git タグ名 -# -# 注意事項 -# * GitHub CLI のアクセス権限設定が必要 - -if gh release view $1 --repo tshion/apply-git-user > /dev/null; then - echo "$1 is already released!" - exit 1 -fi diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index 3b36245..88cf68f 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -51,11 +51,10 @@ jobs: echo "version=$version" >> "$GITHUB_OUTPUT" echo "branch=feature/$version" >> "$GITHUB_OUTPUT" - - name: Can release - env: - GH_TOKEN: ${{ github.token }} - TAG: ${{ steps.meta.outputs.version }} - run: bash .github/scripts/can-release.bash "$TAG" + # https://github.com/tshion/can-create-release + - uses: tshion/can-create-release@0.1.1 + with: + tag: ${{ steps.meta.outputs.version }} - run: npm ci From b8f3a6914abf9f58ece7809206e1887f2d955762 Mon Sep 17 00:00:00 2001 From: tshion Date: Wed, 4 Jun 2025 22:14:47 +0900 Subject: [PATCH 2/2] =?UTF-8?q?released=20=E3=83=96=E3=83=A9=E3=83=B3?= =?UTF-8?q?=E3=83=81=E3=81=A8=E3=81=AE=E6=95=B4=E5=90=88=E6=80=A7=E3=82=92?= =?UTF-8?q?=E3=81=A8=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/create-release-pr.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml index 88cf68f..c31b39c 100644 --- a/.github/workflows/create-release-pr.yml +++ b/.github/workflows/create-release-pr.yml @@ -41,12 +41,14 @@ jobs: cache: npm cache-dependency-path: ./package-lock.json - - name: Set version & format branch name + - name: Set version & Format meta data id: meta env: - VERSION: "${{ inputs.versionMajor }}.${{ inputs.versionMinor }}.${{ inputs.versionPatch }}" + MAJOR: ${{ inputs.versionMajor }} + MINOR: ${{ inputs.versionMinor }} + PATCH: ${{ inputs.versionPatch }} run: | - npm version "$VERSION" --no-git-tag-version + npm version "${MAJOR}.${MINOR}.${PATCH}" --no-git-tag-version version=$(node -p "require('./package.json').version") echo "version=$version" >> "$GITHUB_OUTPUT" echo "branch=feature/$version" >> "$GITHUB_OUTPUT" @@ -56,6 +58,14 @@ jobs: with: tag: ${{ steps.meta.outputs.version }} + - name: Create a working git branch + env: + BRANCH: ${{ steps.meta.outputs.branch }} + run: | + git switch --create "$BRANCH" + git fetch origin released + git merge --allow-unrelated-histories --strategy=ours origin/released + - run: npm ci - run: npm test @@ -68,12 +78,11 @@ jobs: git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" - - name: git add & push + - name: git commit & push env: BRANCH: ${{ steps.meta.outputs.branch }} VERSION: ${{ steps.meta.outputs.version }} run: | - git switch --create "$BRANCH" git add compiled git add package.json git add package-lock.json