-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathaction.yml
More file actions
85 lines (73 loc) · 2.68 KB
/
Copy pathaction.yml
File metadata and controls
85 lines (73 loc) · 2.68 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Update Rust Version
description: "Update and commit the release version in cargo"
inputs:
token:
description: 'A Github PAT with write access to the repository'
required: true
bot-name:
default: 'github-actions[bot]'
required: false
bot-email:
default: 'github-actions[bot]@users.noreply.github.com'
required: false
outputs:
version:
description: The release version
value: ${{ steps.clean_version.outputs.version }}
runs:
using: composite
steps:
- name: Cocogitto Release
id: release
uses: cocogitto/cocogitto-action@v3
with:
check: true
check-latest-tag-only: true
release: true
git-user: ${{ inputs.bot-name }}
git-user-email: ${{ inputs.bot-email }}
- name: Update version in Cargo.toml and Cargo.lock
shell: bash
run: |
version=$(echo "${{ steps.release.outputs.version }}" | sed 's/v//g')
package_name=$(sed -n 's/^name = "\(.*\)"/\1/p' ./Cargo.toml)
sed "s/^version = \".*\"\$/version = \"$version\"/" ./Cargo.toml > /tmp/cargo.toml
sed -e "/^name = \"$package_name\"\$/{ n; s/^version = \".*\"\$/version = \"$version\"/g; }" ./Cargo.lock > /tmp/cargo.lock
mv /tmp/cargo.toml ./Cargo.toml
mv /tmp/cargo.lock ./Cargo.lock
- name: Set up git authentication
shell: bash
run: |
git config --global user.name "${{ inputs.bot-name }}"
git config --global user.email "${{ inputs.bot-email }}"
git remote set-url origin https://x-access-token:${{ inputs.token }}@github.com/${{ github.repository }}
- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "chore: Bump version for release"
file_pattern: "Cargo.toml Cargo.lock"
commit_user_name: ${{ inputs.bot-name }}
commit_user_email: ${{ inputs.bot-email }}
- name: Install Rust
uses: WalletConnect/actions-rs/toolchain@2.0.0
with:
toolchain: stable
profile: minimal
default: true
- name: Cache cargo registry
uses: Swatinem/rust-cache@v2
- name: Generate Changelog
shell: bash
run: cog changelog --at ${{ steps.release.outputs.version }} -t full_hash > GITHUB_CHANGELOG.md
- name: Update GitHub release notes
uses: softprops/action-gh-release@v3
with:
body_path: GITHUB_CHANGELOG.md
tag_name: ${{ steps.release.outputs.version }}
token: ${{ inputs.token }}
- name: Clean Version
id: clean_version
shell: bash
run: |
version=$(echo "${{ steps.release.outputs.version }}" | sed 's/v//g')
echo "version=$version" >> $GITHUB_OUTPUT