name: Release
on:
workflow_dispatch:
inputs:
tag:
description: "Tag in the format X.Y.Z"
required: true
type: string
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- run: |
gh release delete ${{ github.event.inputs.tag }} -y || true
git tag -d ${{ github.event.inputs.tag }} || true
git push origin --delete ${{ github.event.inputs.tag }} || true
git fetch --tags
echo Using given tag ${{ github.event.inputs.tag }}
- uses: Swatinem/rust-cache@v2
- run: |
cargo run --locked -- remove -n -1 || true
# needed for the --since to work correctly in case things are wrong
cargo run --locked -- remove -v ${{ github.event.inputs.tag }} || true
cargo run --locked -- generate --exclude-unidentified
cargo run --locked -- release -v ${{ github.event.inputs.tag }} --force
cargo test --locked gen::gen_doc -- --include-ignored
# cargo run --locked --bin gen-doc
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(changelog): automatic release generation (skip changelog) [skip ci]"
tagging_message: ${{ github.event.inputs.tag }}
- run: |
echo "$(sed 's/{VERSION}/${{ github.event.inputs.tag }}/g' ./res/HEADER_FOR_RELEASE.md)" > RELEASE_CHANGELOG.md
cargo run --locked -- show >> RELEASE_CHANGELOG.md
# https://cli.github.com/manual/gh_release_create
gh release create ${{ github.event.inputs.tag }} --title ${{ github.event.inputs.tag }} \
--notes-file RELEASE_CHANGELOG.md --target $GITHUB_SHA
upload-assets:
needs: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: changen
ref: refs/tags/${{ github.event.inputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}