build(deps-dev): bump @semantic-release/commit-analyzer from 10.0.1 t… #626
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Release" | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '!*' | |
jobs: | |
next-version: | |
name: Get next release version | |
runs-on: ubuntu-latest | |
outputs: | |
need-release: ${{ steps.need-release.outputs.result }} | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: install dependencies | |
run: npm ci | |
- name: find current latest release version | |
uses: pozetroninc/github-action-get-latest-release@master | |
id: last-release | |
with: | |
repository: ${{ github.repository }} | |
token: ${{ secrets.CUSTOM_GITHUB_PERSONAL_TOKEN }} | |
- name: find next release version | |
id: next-release | |
run: npm_config_yes=true npx semantic-release --dry-run | |
env: | |
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_PERSONAL_TOKEN }} | |
- name: print discovered versions | |
run: | | |
echo "Last release version = ${{ steps.last-release.outputs.release }}" | |
echo "Next release version = ${{ steps.next-release.outputs.new-release-version }}" | |
- name: check if we need a new release | |
uses: actions/github-script@v6 | |
id: need-release | |
env: | |
LAST_RELEASE: ${{ steps.last-release.outputs.release }} | |
NEW_RELEASE: ${{ steps.next-release.outputs.new-release-version }} | |
with: | |
script: | | |
const semver = require('semver'); | |
const lastRelease = process.env.LAST_RELEASE.replace(/^v/, ''); | |
const newRelease = process.env.NEW_RELEASE.replace(/^v/, ''); | |
return semver.gt(newRelease, lastRelease); | |
result-encoding: string | |
- name: print if we need a new release | |
run: | | |
echo "Need a new release = ${{ steps.need-release.outputs.result }}" | |
release: | |
name: Cut a release on GitHub | |
runs-on: ubuntu-latest | |
needs: next-version | |
if: needs.next-version.outputs.need-release == 'true' | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: install dependencies | |
run: npm ci | |
- name: make a release on GitHub | |
run: npm_config_yes=true npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_PERSONAL_TOKEN }} | |
GIT_AUTHOR_NAME: 'GP' | |
GIT_COMMITTER_NAME: 'GP' | |
GIT_AUTHOR_EMAIL: 'me@httgp.com' | |
GIT_COMMITTER_EMAIL: 'me@httgp.com' |