Skip to content

Commit 09ce241

Browse files
authored
chore: use workflow dispatch to publish (#170)
1 parent 819e805 commit 09ce241

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

.github/workflows/Publish.yaml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
name: Publish
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_dispatch:
5+
inputs:
6+
dry_run:
7+
type: boolean
8+
description: "DryRun release"
9+
required: true
10+
default: false
11+
push_tags:
12+
type: boolean
13+
description: "Push tags to repository"
14+
required: true
15+
default: true
616

717
jobs:
818
publish:
@@ -12,8 +22,17 @@ jobs:
1222
id-token: write # Required for OIDC token exchange
1323
steps:
1424
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
15-
- uses: rust-lang/crates-io-auth-action@63a7064947ceca9989005e118db3a5fecdc9259f # v1.0.1
25+
- uses: rust-lang/crates-io-auth-action@e919bc7605cde86df457cf5b93c5e103838bd879 # v1.0.1
1626
id: auth
17-
- run: cargo publish -vv
27+
- run: cargo publish -vv ${{ inputs.dry_run && '--dry-run' || '' }}
1828
env:
1929
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
30+
- if: ${{ inputs.push_tags }}
31+
run: |
32+
PUBLISHED_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')
33+
git config --global --add safe.directory /github/workspace
34+
git config --global user.name "github-actions[bot]"
35+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
36+
git status
37+
git tag $PUBLISHED_VERSION -m $PUBLISHED_VERSION
38+
git push origin --follow-tags

0 commit comments

Comments
 (0)