From 10bc979423492a6f474c02cfd6cfc810174ae515 Mon Sep 17 00:00:00 2001 From: Mitsuharu Emoto Date: Fri, 19 Jul 2024 19:54:38 +0900 Subject: [PATCH] add actions --- .github/workflows/bump-version.yml | 43 +++++++++++++++++++++++++++ .github/workflows/release-on-main.yml | 29 ++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/workflows/bump-version.yml create mode 100644 .github/workflows/release-on-main.yml diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000..aff1707 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,43 @@ +name: Bump version on develop + +on: + workflow_dispatch: + inputs: + version_bump: + description: 'Version bump type' + required: true + default: 'patch' + type: choice + options: + - major + - minor + - patch + +jobs: + bump-version: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Bump version + run: yarn release -- ${{github.event.inputs.version_bump}} + + - name: Commit and push changes + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "chore: bump version" + git push origin HEAD:develop + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-on-main.yml b/.github/workflows/release-on-main.yml new file mode 100644 index 0000000..ed05dc1 --- /dev/null +++ b/.github/workflows/release-on-main.yml @@ -0,0 +1,29 @@ +name: Release on main merge + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org/' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Run release-it + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: yarn release