Skip to content

Commit 6bd2dcd

Browse files
committed
fix: release workflow
1 parent 145bcd9 commit 6bd2dcd

4 files changed

Lines changed: 37 additions & 30 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: publish
22

33
on:
44
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
58

69
jobs:
710
publish_gh_packages:
@@ -33,26 +36,3 @@ jobs:
3336
run: pnpm publish --access restricted
3437
env:
3538
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
37-
release:
38-
needs: publish_gh_packages
39-
runs-on: ubuntu-latest
40-
41-
permissions:
42-
contents: write # publish a GitHub release
43-
issues: write # comment on released issues
44-
pull-requests: write # comment on released pull requests
45-
46-
steps:
47-
- uses: actions/checkout@v4
48-
with:
49-
fetch-depth: 0
50-
51-
- uses: actions/setup-node@v4
52-
with:
53-
node-version: "lts/*"
54-
55-
- name: semantic-release
56-
run: npx semantic-release@24
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@ name: release
22

33
on:
44
workflow_dispatch:
5+
workflow_run:
6+
workflows:
7+
- publish
8+
types:
9+
- completed
510

611
jobs:
712
release:
13+
# Run on manual dispatch OR when the `publish` workflow completes successfully.
14+
# When triggered by workflow_run, `github.event.workflow_run.conclusion` is set.
15+
# Keep manual dispatch available as well.
16+
if: "${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}"
817
runs-on: ubuntu-latest
918

1019
permissions:
@@ -20,8 +29,30 @@ jobs:
2029
- uses: actions/setup-node@v4
2130
with:
2231
node-version: "lts/*"
32+
- name: Read package version
33+
id: pkg
34+
run: echo "version=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT
2335

24-
- name: semantic-release
25-
run: npx semantic-release@24
36+
- name: Create tag from package.json version
37+
env:
38+
VERSION: ${{ steps.pkg.outputs.version }}
39+
run: |
40+
set -e
41+
TAG="v${VERSION}"
42+
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "$TAG"; then
43+
echo "Tag $TAG already exists on remote."
44+
else
45+
git config user.name "github-actions[bot]"
46+
git config user.email "github-actions[bot]@users.noreply.github.com"
47+
git tag -a "$TAG" -m "Release $TAG"
48+
git push origin "$TAG"
49+
fi
50+
51+
- name: Create GitHub release
52+
uses: softprops/action-gh-release@v2
53+
with:
54+
tag_name: v${{ steps.pkg.outputs.version }}
55+
name: Release v${{ steps.pkg.outputs.version }}
56+
generate_release_notes: true
2657
env:
2758
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.releaserc.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tauri-plugin-keystore"
3-
version = "2.2.0"
3+
version = "2.3.1"
44
authors = ["0x330a"]
55
description = "Interact with the device-native key storage (Android Keystore, iOS Keychain) & perform ecdh operations for generating symmetric keys"
66
edition = "2021"

0 commit comments

Comments
 (0)