Skip to content

Commit 5566f69

Browse files
authored
Fix/release workflow (#7)
* fix: release workflow * 2.3.1 * fix: release workflow
1 parent 145bcd9 commit 5566f69

5 files changed

Lines changed: 41 additions & 31 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: 36 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:
@@ -21,7 +30,32 @@ jobs:
2130
with:
2231
node-version: "lts/*"
2332

24-
- name: semantic-release
25-
run: npx semantic-release@24
33+
- name: Read package version
34+
id: pkg
35+
run: |
36+
VERSION=$(node -p 'require("./package.json").version')
37+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
38+
39+
- name: Create tag from package.json version
40+
env:
41+
VERSION: ${{ steps.pkg.outputs.version }}
42+
run: |
43+
set -e
44+
TAG="v${VERSION}"
45+
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "$TAG"; then
46+
echo "Tag $TAG already exists on remote."
47+
else
48+
git config user.name "github-actions[bot]"
49+
git config user.email "github-actions[bot]@users.noreply.github.com"
50+
git tag -a "$TAG" -m "Release $TAG"
51+
git push origin "$TAG"
52+
fi
53+
54+
- name: Create GitHub release
55+
uses: softprops/action-gh-release@v2
56+
with:
57+
tag_name: v${{ steps.pkg.outputs.version }}
58+
name: Release v${{ steps.pkg.outputs.version }}
59+
generate_release_notes: true
2660
env:
2761
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"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metasig/tauri-plugin-keystore-api",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"author": "0x330a",
55
"description": "Interact with the device-native key storage (Android Keystore, iOS Keychain) & perform ecdh operations for generating symmetric keys",
66
"type": "module",

0 commit comments

Comments
 (0)