Merge pull request #394 from chizmw/new-character-summoner #57
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: Changeset Release | |
# yamllint disable rule:truthy | |
on: | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
permissions: read-all | |
jobs: | |
release: | |
# IMPORTANT: prevent this action from running on forks | |
if: github.repository == 'chizmw/botc-custom-script-json2pdf' | |
permissions: | |
contents: write # to create release (changesets/action) | |
pull-requests: write # to create pull request (changesets/action) | |
name: Changeset Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CHANGESETS_TOKEN }} | |
# we want to know about all the tags | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install Dependencies | |
run: yarn | |
- name: Create Release Pull Request | |
id: changesets | |
uses: changesets/action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.CHANGESETS_TOKEN }} | |
with: | |
title: Release Changeset (bake CHANGELOG.md) | |
# we use ourself to get the information for the release | |
- name: Get Change Info | |
uses: chizovation/[email protected] | |
id: get-changelog-info | |
- name: Debug Tag Step | |
shell: bash | |
run: | | |
set -x | |
TAG_NAME=${{ steps.get-changelog-info.outputs.last-change-version-v }} | |
if git tag -l | grep -q "^${TAG_NAME}$"; then | |
echo "Tag ${TAG_NAME} already exists" | |
else | |
echo "Tag ${TAG_NAME} is new" | |
fi | |
- name: Push Tags | |
# https://github.com/changesets/action#custom-publishing | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
shell: bash | |
run: | | |
TAG_NAME=${{ steps.get-changelog-info.outputs.last-change-version-v }} | |
# try not to recreate the tag | |
if git tag -l | grep -q "^${TAG_NAME}$"; then | |
echo "Tag ${TAG_NAME} already exists" | |
else | |
git tag ${TAG_NAME} | |
git push --tag | |
fi |