-
Notifications
You must be signed in to change notification settings - Fork 15
46 lines (44 loc) · 1.52 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## Automatic release process
# This workflow is a manually-triggered workflow, which automatically bumps the
# version and publishes the new crate version to crates.io. This uses an API
# token stored in the Github secret `CRATES_IO`.
name: Release crate
on:
workflow_dispatch:
inputs:
version:
description: The new crate version to release, must be a non-existing version
required: true
env:
CRATES_IO: ${{ secrets.CRATES_IO }}
VERSION: ${{ github.event.inputs.version }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Configure git user for Bot
run: |
git config --global user.email 'noreply@github.com'
git config --global user.name 'GitHub Actions Release Bot'
- name: Create release commit
run: |
sed -i "0,/version = /{s/^version = .*$/version = \"${VERSION}\"/}" Cargo.toml
cargo check
git add Cargo.toml Cargo.lock
sed -i "s/^## unreleased$/## Version ${VERSION}/" CHANGELOG.md
sed -i '3i ## unreleased\n' CHANGELOG.md
git add CHANGELOG.md
git commit -m "Release version \`${VERSION}\`" || :
- name: Create tag
run: git tag -a "${VERSION}" -m "v${VERSION}"
- name: Show commit
run: git show
- name: Push changes
run: |
git push --tags
git push
- name: Publish to crates.io
run: cargo publish --token "${CRATES_IO}"