diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3bac6a2..e52a1d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,28 +1,39 @@ name: release + on: push: branches: - main + +permissions: + contents: write + issues: write + pull-requests: write + jobs: release: name: release runs-on: ubuntu-latest steps: + # build local version to create token - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-node@v4 with: - node-version: '20' + node-version-file: .node-version + cache: 'npm' + - run: npm ci - run: npm run build - - run: rm .gitignore # dist/ folder is ignored by default - - run: | - git config user.name github-actions - git config user.email github-actions@github.com - git add .gitignore dist/ - git commit -m "build" - git push --force https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: npx semantic-release + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.RELEASER_APP_ID }} + private-key: ${{ secrets.RELEASER_APP_PRIVATE_KEY }} + # install release dependencies and release + - run: npm install --no-save @semantic-release/git semantic-release-plugin-github-breaking-version-tag + - run: npx semantic-release --debug env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b65b494..c2658d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -dist -node_modules/ \ No newline at end of file +node_modules/ diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +20 diff --git a/package.json b/package.json index 5172f27..fab36fd 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,25 @@ }, "release": { "branches": [ + "+([0-9]).x", "main" + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/github", + "@semantic-release/npm", + "semantic-release-plugin-github-breaking-version-tag", + [ + "@semantic-release/git", + { + "assets": [ + "package.json", + "dist/*" + ], + "message": "build(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ] ] } }