build: Check release version against changes #29
This file contains hidden or 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: ["release"] | |
jobs: | |
release-prebuild: | |
uses: ./.github/workflows/build.yml | |
release: | |
runs-on: ubuntu-latest | |
needs: release-prebuild | |
steps: | |
- name: set git config | |
run: | | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com" | |
git config -l | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # We need a deep clone to calculate new version | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions | |
with: | |
version: 9 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Create changelog and tag version | |
run: | | |
pnpm install | |
./release | |
- name: Push version | |
# Push the release to 'main' branch if it's ahead of main. | |
run: | | |
if git merge-base --is-ancestor remotes/origin/main HEAD; then git push origin HEAD:main; fi | |
git push --tags |