Create and publish a new release #5
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: Create and publish a new release | |
on: | |
workflow_dispatch: | |
inputs: | |
first-release: | |
description: > | |
Create the first release. If version is not specified, | |
it will be set to '1.0.0'. No changelog will be generated. | |
type: boolean | |
required: false | |
default: false | |
version: | |
description: > | |
Release as the provided version. Should be a valid semvar | |
version, or one of 'major', 'minor', or 'patch'. If not | |
provided, version is determined automatically from commits | |
since the previous release. | |
type: string | |
required: false | |
default: "" | |
pre-release: | |
description: > | |
Make a pre-release. If a custom version is specified, or a first | |
release is being made, a pre-release tag must also be provided, | |
or the custom version should be of the form | |
'<major>.<minor>.<patch>-<pre-release-tag>'. | |
type: boolean | |
required: false | |
default: false | |
pre-release-tag: | |
description: > | |
Use provided tag for pre-release. This only has effect | |
if making a pre-release, and will create release with version | |
'<major>.<minor>.<patch>-<pre-release-tag>-<pre-release-version>'. | |
type: string | |
required: false | |
default: "" | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
call-run-tests: | |
uses: ./.github/workflows/run-tests.yml | |
with: | |
fail-fast: true | |
create-release: | |
runs-on: ubuntu-latest | |
needs: call-run-tests | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_PAT }} | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
- run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
python-version-file: pyproject.toml | |
cache: poetry | |
- run: poetry install | |
- run: SKIP=test poetry run pre-commit run --all-files | |
- name: Configure git | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email \ | |
"${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | |
- name: Bump version and create changelog | |
run: > | |
./scripts/commit_and_tag_version.py | |
-f ${{ inputs.first-release }} | |
-r ${{ inputs.version }} | |
-p ${{ inputs.pre-release }} | |
-t ${{ inputs.pre-release-tag }} | |
- run: git push --follow-tags origin master | |
- run: npx conventional-github-releaser -p angular | |
env: | |
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.REPO_PAT }} | |
- name: Get latest git tag | |
id: tag | |
run: echo "tag=$( git describe --tags --abbrev=0 )" >> $GITHUB_OUTPUT | |
- name: Extract major and minor versions of latest release | |
id: version | |
run: | | |
echo "version=$( echo ${{ steps.tag.outputs.tag }} \ | |
| sed -E 's/^v([0-9]+)\.([0-9]+)\..*$/\1.\2/' )" >> $GITHUB_OUTPUT | |
- name: Publish site for new release | |
if: ${{ ! inputs.pre-release }} | |
run: | | |
poetry run mike set-default --allow-undefined latest | |
poetry run mike deploy --update-aliases --push --allow-empty \ | |
${{ steps.version.outputs.version }} latest |