File tree Expand file tree Collapse file tree 5 files changed +73
-436
lines changed
Expand file tree Collapse file tree 5 files changed +73
-436
lines changed Original file line number Diff line number Diff line change 1+ name : Create Release
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - " Cargo.toml"
9+
10+ jobs :
11+ create_release :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v2
17+
18+ - name : Extract version from Cargo.toml
19+ id : extract_version
20+ run : |
21+ version=$(grep '^version' Cargo.toml | sed -E 's/version = "(.*)"/\1/')
22+ echo "::set-output name=version::$version"
23+
24+ - name : Check if tag exists
25+ id : check_tag
26+ run : |
27+ version=v${{ steps.extract_version.outputs.version }}
28+ if git rev-parse "$version" >/dev/null 2>&1; then
29+ echo "Tag $version already exists."
30+ exit 0
31+ else
32+ echo "Tag $version does not exist."
33+ echo "::set-output name=tag::$version"
34+ fi
35+
36+ - name : Create Release
37+ if : steps.check_tag.outputs.tag
38+ uses : actions/create-release@v1
39+ with :
40+ tag_name : ${{ steps.check_tag.outputs.tag }}
41+ release_name : ${{ steps.extract_version.outputs.version }}
42+ body : |
43+ Changes in this release:
44+ ${{ github.event.head_commit.message }}
45+ draft : false
46+ prerelease : false
47+ env :
48+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1+ name : Publish Crate
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+ publish :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout repository
13+ uses : actions/checkout@v2
14+
15+ - name : Set up Rust
16+ uses : actions-rs/toolchain@v1
17+ with :
18+ toolchain_file : true
19+
20+ - name : Publish to crates.io
21+ run : cargo publish
22+ env :
23+ CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
You can’t perform that action at this time.
0 commit comments