diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 7bbe94e..0d886fb 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -2,6 +2,9 @@ name: publish on: workflow_dispatch: + push: + branches: + - main jobs: publish_gh_packages: @@ -33,26 +36,3 @@ jobs: run: pnpm publish --access restricted env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - release: - needs: publish_gh_packages - runs-on: ubuntu-latest - - permissions: - contents: write # publish a GitHub release - issues: write # comment on released issues - pull-requests: write # comment on released pull requests - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - with: - node-version: "lts/*" - - - name: semantic-release - run: npx semantic-release@24 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index efaaaa1..512d74d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,9 +2,18 @@ name: release on: workflow_dispatch: + workflow_run: + workflows: + - publish + types: + - completed jobs: release: + # Run on manual dispatch OR when the `publish` workflow completes successfully. + # When triggered by workflow_run, `github.event.workflow_run.conclusion` is set. + # Keep manual dispatch available as well. + if: "${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}" runs-on: ubuntu-latest permissions: @@ -21,7 +30,32 @@ jobs: with: node-version: "lts/*" - - name: semantic-release - run: npx semantic-release@24 + - name: Read package version + id: pkg + run: | + VERSION=$(node -p 'require("./package.json").version') + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Create tag from package.json version + env: + VERSION: ${{ steps.pkg.outputs.version }} + run: | + set -e + TAG="v${VERSION}" + if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "$TAG"; then + echo "Tag $TAG already exists on remote." + else + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "$TAG" -m "Release $TAG" + git push origin "$TAG" + fi + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ steps.pkg.outputs.version }} + name: Release v${{ steps.pkg.outputs.version }} + generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.releaserc.yaml b/.releaserc.yaml deleted file mode 100644 index 4e9b8f6..0000000 --- a/.releaserc.yaml +++ /dev/null @@ -1,4 +0,0 @@ -plugins: - - "@semantic-release/commit-analyzer" - - "@semantic-release/release-notes-generator" - - "@semantic-release/github" diff --git a/Cargo.toml b/Cargo.toml index 8bf8725..505e613 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-keystore" -version = "2.2.0" +version = "2.3.1" authors = ["0x330a"] description = "Interact with the device-native key storage (Android Keystore, iOS Keychain) & perform ecdh operations for generating symmetric keys" edition = "2021" diff --git a/package.json b/package.json index 0ca04ea..6724d43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@metasig/tauri-plugin-keystore-api", - "version": "2.3.0", + "version": "2.3.1", "author": "0x330a", "description": "Interact with the device-native key storage (Android Keystore, iOS Keychain) & perform ecdh operations for generating symmetric keys", "type": "module",