name: Release
on:
workflow_dispatch: inputs:
one_time_crates_io_token_secret:
description: "A one-time crates.io token (delete it after first use)"
required: true
type: string
env:
CARGO_TERM_COLOR: always
jobs:
ci:
uses: ./.github/workflows/CI.yml
publish-and-tag:
needs: ci
runs-on: ubuntu-latest
permissions:
contents: write outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
TAG_NAME: ${{ steps.version.outputs.TAG_NAME }}
steps:
- run: |
# See https://github.com/actions/runner/issues/643#issuecomment-708468716
# See https://github.com/actions/runner/issues/475#issuecomment-635775403
masked_secret=$(jq -r '.inputs.one_time_crates_io_token_secret' $GITHUB_EVENT_PATH)
echo "::add-mask::$masked_secret"
- uses: actions/checkout@v4
- run: cargo publish -p syntect
env:
CARGO_REGISTRY_TOKEN: ${{ inputs.one_time_crates_io_token_secret }}
- name: version
id: version
run: |
version=$(cargo read-manifest --manifest-path Cargo.toml | jq --raw-output .version)
echo "VERSION=${version}" >> $GITHUB_OUTPUT
echo "TAG_NAME=v${version}" >> $GITHUB_OUTPUT
- name: push tag
run: |
git tag ${{ steps.version.outputs.TAG_NAME }}
git push origin ${{ steps.version.outputs.TAG_NAME }}
release:
needs: publish-and-tag
runs-on: ubuntu-latest
permissions:
contents: write steps:
- uses: actions/checkout@v4
- run: cargo install parse-changelog@0.6.4 --locked
- name: create release
env:
GH_TOKEN: ${{ github.token }}
run: |
notes="$(parse-changelog CHANGELOG.md ${{ needs.publish-and-tag.outputs.VERSION }})"
title="${{ needs.publish-and-tag.outputs.TAG_NAME }}"
gh release create --title "$title" --notes "$notes" ${{ needs.publish-and-tag.outputs.TAG_NAME }}