Skip to content

Remove git cliff action residue #30

Remove git cliff action residue

Remove git cliff action residue #30

Workflow file for this run

name: Publish a release

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

(Line: 83, Col: 13): A sequence was not expected
on:
workflow_dispatch:
inputs:
release_type:
required: true
type: choice
options:
- patch
- minor
- major
- none
stability:
required: true
type: choice
options:
- latest
- beta
jobs:
prepare_metadata:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.bump_version.outputs.version }}
release_sha: ${{ steps.commit.outputs.commit_long_sha || github.sha }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_TOKEN }}
- name: Set up git
run: |
git config --global user.email "ci@bucharjan.cz"
git config --global user.name "Jan Buchar"
- name: Install dependencies
run: |
yarn install
- name: Bump version in package.json
id: bump_version
run: |
release_type=${{ github.event.inputs.release_type }}
if [ "${{ github.event.inputs.stability }}" = "beta" ]; then
if [ "${{ github.event.inputs.release_type }}" = "none" ]; then
release_type=prerelease
else
release_type=pre$release_type
fi
else
if [ "${{ github.event.inputs.release_type }}" = "none" ]; then
echo "Release type 'none' only works with 'beta' releases" >&2
exit 1
fi
fi
npm version --no-git-tag-version --preid b $release_type
echo version=$( node -p "require('./package.json').version" ) >> "$GITHUB_OUTPUT"
- name: Update changelog
if: ${{ github.event.inputs.stability == 'latest' }}
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --tag "release-${{ steps.bump_version.outputs.version }}"
env:
OUTPUT: CHANGELOG.md
- name: Fix formatting
run: |
yarn lint:fix
- name: Commit changes
id: commit
uses: EndBug/add-and-commit@v9
with:
add:
- package.json
- CHANGELOG.md
author_name: Jan Buchar
author_email: ci@bucharjan.cz
message: "chore(release): ${{ steps.bump_version.outputs.version }} [skip ci]"
gh_release:
runs-on: ubuntu-latest
needs: prepare_metadata
if: ${{ github.event.inputs.stability == 'latest' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate release notes
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --tag "release-${{ needs.prepare_metadata.outputs.version }}" --unreleased --strip all
env:
OUTPUT: release_notes.md
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: release-${{ needs.prepare_metadata.outputs.version }}
name: Release ${{ needs.prepare_metadata.outputs.version }}
target_commitish: ${{ needs.prepare_metadata.outputs.release_sha }}
body_path: release_notes.md
npm_publish:
runs-on: ubuntu-latest
needs: prepare_metadata
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare_metadata.outputs.release_sha }}
- name: Build
run: |
yarn install
yarn build
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Publish to NPM
run: |
npm publish --tag "${{ github.event.inputs.stability }}"