Skip to content

Commit 080803a

Browse files
authored
Merge pull request #66 from tmccombs/release-updates
Release updates
2 parents 2ca88d7 + 5d5940f commit 080803a

File tree

5 files changed

+75
-12
lines changed

5 files changed

+75
-12
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ updates:
99
directory: "/"
1010
schedule:
1111
interval: "monthly"
12+
cooldown:
13+
default-days: 7
14+
groups:
15+
bump:
16+
applies-to: "version-updates"
17+
security:
18+
applies-to: "security-updates"
1219
- package-ecosystem: "github-actions"
1320
directory: "/"
1421
schedule:
1522
interval: "monthly"
23+
cooldown:
24+
default-days: 7

.github/workflows/publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v5
11+
- name: Install toolchain
12+
run: |
13+
rustup toolchain install stable --profile minimal
14+
rustup default stable
15+
- name: Publish
16+
run: cargo publish
17+
env:
18+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
19+

.github/workflows/release.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,50 @@
11
name: Release
22
on:
3-
release:
4-
types: [published]
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
type: string
7+
required: true
8+
9+
10+
env:
11+
VERSION: "${{ inputs.version }}"
512

613
jobs:
7-
publish:
14+
release:
815
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
918
steps:
10-
- uses: actions/checkout@v5
11-
- name: Install toolchain
19+
- name: checkout
20+
uses: actions/checkout@v5
21+
with:
22+
persist-credentials: true
23+
fetch-depth: 0
24+
- name: Git setup
1225
run: |
13-
rustup toolchain install stable --profile minimal
14-
rustup default stable
15-
- name: Publish
16-
run: cargo publish
26+
git config user.name "github-actions[bot]"
27+
git config user.email " 41898282+github-actions[bot]@users.noreply.github.com"
28+
- name: Update changelog
29+
uses: orhun/git-cliff-action@d77b37db2e3f7398432d34b72a12aa3e2ba87e51 # v4.6.0
30+
with:
31+
args: "--unreleased"
1732
env:
18-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
33+
OUTPUT: release.md
34+
GIT_CLIFF_PREPEND: CHANGELOG.md
35+
GIT_CLIFF_TAG: "v${{ inputs.version }}"
36+
GITHUB_REPO: ${{ github.repository }}
37+
- name: Update Cargo.toml
38+
run: |
39+
awk -i inplace -f update-version.awk Cargo.toml
40+
- name: Commit and push changes
41+
run: |
42+
set +e
43+
git add CHANGELOG.md Cargo.toml
44+
git commit -m "Update version to ${VERSION}"
45+
git push "https://github.com/${GITHUB_REPOSITORY}.git" main
46+
- name: Create release
47+
run: |
48+
gh release create --notes-file release.md "v${VERSION}"
49+
1950

docs/RELEASE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ Steps to create a new release:
44
2. Run `gi-cliff -p CHANGELOG.md -u -t <new-tag>` to update the changelog
55
3. Merge changes
66
4. Publish a new release for the target tag.
7-
8-
TODO: Create github action to do all of this.

tools/update-version.awk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$0 == "[package]" { inpkg = 1; }
2+
inpkg && /^version +=/ {
3+
sub(/"[^"]*"/, "\"" ENVIRON["VERSION"] "\"")
4+
inpkg = 0
5+
}
6+
{ print }

0 commit comments

Comments
 (0)