From 5a978f3365ed335c70159e8c347c0688b4b27eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=AA=E7=8C=AB?= Date: Sun, 29 Dec 2024 05:06:27 +0900 Subject: [PATCH 1/2] Create version-up.yml --- .github/workflows/version-up.yml | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/version-up.yml diff --git a/.github/workflows/version-up.yml b/.github/workflows/version-up.yml new file mode 100644 index 0000000..3839c36 --- /dev/null +++ b/.github/workflows/version-up.yml @@ -0,0 +1,54 @@ +name: Version up + +on: + workflow_dispatch: + inputs: + semantic: + description: Semantic versioning + required: true + default: patch + type: choice + options: + - major + - minor + - patch + +jobs: + version-up: + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v4 + - name: Package + run: | + npm ci + npm run package + - name: Version up + id: version + run: | + set -x + version=$(npm --no-git-tag-version version $SEMANTIC) + echo "::set-output name=version::${version}" + sed -i -e "s|${GITHUB_REPOSITORY}@v[.0-9]\+|${GITHUB_REPOSITORY}@${version}|g" README.md + git diff + env: + SEMANTIC: ${{ github.event.inputs.semantic }} + - uses: snow-actions/git-config-user@v1.0.0 + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Commit & PR + run: | + set -x + branch="release/${VERSION}" + git switch -c ${branch} + git add . + git commit -m "${VERSION}" + git push origin ${branch} + gh pr create --base ${GITHUB_REF_NAME} --head ${branch} --assignee ${GITHUB_ACTOR} --title ${VERSION} --body '' + env: + VERSION: ${{ steps.version.outputs.version }} + GH_TOKEN: ${{ steps.app-token.outputs.token }} From 064a7dc3486f7f0f7d955ced2859e01882d479ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=AA=E7=8C=AB?= Date: Sun, 29 Dec 2024 05:07:04 +0900 Subject: [PATCH 2/2] Create release.yml --- .github/workflows/release.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d467c5c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: Release + +on: + pull_request: + types: [ closed ] + +jobs: + release: + if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') + runs-on: ubuntu-latest + timeout-minutes: 5 + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + RELEASE_BRANCH: ${{ github.event.pull_request.head.ref }} + + steps: + - name: Create release + run: | + version=${RELEASE_BRANCH#release/} + gh release create ${version} --title ${version} --generate-notes --discussion-category Announcements