From 26b0381217cd4a95fbab123cb09f83b3c7c2626d Mon Sep 17 00:00:00 2001 From: Brice Vandeputte Date: Fri, 10 Oct 2025 18:07:50 +0200 Subject: [PATCH] Fix #15 immutable release, gh create release, add minor/major workflows --- .github/CONTRIBUTING.md | 20 ++++++++++++++++++++ .github/workflows/major.yml | 37 +++++++++++++++++++++++++++++++++++++ .github/workflows/minor.yml | 37 +++++++++++++++++++++++++++++++++++++ .github/workflows/patch.yml | 3 +-- 4 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/major.yml create mode 100644 .github/workflows/minor.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c203976..339371f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -17,3 +17,23 @@ You could also be critic with existing ticket/PR : all constructive feedbacks ar * launch tests using `pnpm test`. Think about environment setup. + + +## HowTo create a fresh version +- use patch or minor or major workflow + +this will make a new version and on version tag, the main ci workflow will push a new npmjs version too. + +## HowTo release using `gh` + +Install and create automatically a draft release version using [gh client](https://cli.github.com/) +- the version tag must exist + +Example to create v1.1.0 +```bash +gh release create v1.1.0 --draft --generate-notes +``` +this will make a new draft release. Verify it in [releases list](https://github.com/creharmony/node-hook-action/releases) + +- ⚠️ the repository apply immutable releases since #15 (`v1.1.0`), so you can't modify a release once published +- publish the release when ready \ No newline at end of file diff --git a/.github/workflows/major.yml b/.github/workflows/major.yml new file mode 100644 index 0000000..47dcd98 --- /dev/null +++ b/.github/workflows/major.yml @@ -0,0 +1,37 @@ +name: major +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + # version from package.json + run_install: false + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v5 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Major + run: | + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git config --global user.name 'github-actions[bot]' + git fetch --all + git checkout main + pnpm version major + git branch -f npmjs + git push origin main npmjs --tags \ No newline at end of file diff --git a/.github/workflows/minor.yml b/.github/workflows/minor.yml new file mode 100644 index 0000000..00aaadd --- /dev/null +++ b/.github/workflows/minor.yml @@ -0,0 +1,37 @@ +name: minor +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + # version from package.json + run_install: false + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v5 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Minor + run: | + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git config --global user.name 'github-actions[bot]' + git fetch --all + git checkout main + pnpm version minor + git branch -f npmjs + git push origin main npmjs --tags \ No newline at end of file diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml index 4daeed6..e4b97ff 100644 --- a/.github/workflows/patch.yml +++ b/.github/workflows/patch.yml @@ -1,5 +1,4 @@ -# create patch from 'main' branch -name: nha-patch +name: patch on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: