From 3fddf476de455d45d1a4bfd7e42347842f4077b4 Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Tue, 25 Apr 2023 17:31:33 +0200 Subject: [PATCH] ci: set up covector (#329) * ci: set up covector * remove postpublish * push new tags to mirrors * fetch tags of current repo in workflow file * use our fork of create-pull-request action * fmt * use org tokens * simplify string subst * fmt again --- .changes/config.json | 171 ++++++++++++++++++ .changes/readme.md | 30 +++ .github/sync-to-mirrors.sh | 14 ++ .github/workflows/covector-status.yml | 16 ++ .../workflows/covector-version-or-publish.yml | 59 ++++++ .github/workflows/sync.yml | 8 + Cargo.lock | 24 +-- plugins/authenticator/Cargo.toml | 2 +- plugins/autostart/Cargo.toml | 2 +- plugins/fs-extra/Cargo.toml | 2 +- plugins/fs-watch/Cargo.toml | 2 +- plugins/log/Cargo.toml | 2 +- plugins/positioner/Cargo.toml | 2 +- plugins/positioner/package.json | 2 +- plugins/single-instance/Cargo.toml | 2 +- plugins/sql/Cargo.toml | 2 +- plugins/store/Cargo.toml | 2 +- plugins/stronghold/Cargo.toml | 2 +- plugins/upload/Cargo.toml | 2 +- plugins/websocket/Cargo.toml | 2 +- plugins/window-state/package.json | 2 +- 21 files changed, 324 insertions(+), 26 deletions(-) create mode 100644 .changes/config.json create mode 100644 .changes/readme.md create mode 100644 .github/workflows/covector-status.yml create mode 100644 .github/workflows/covector-version-or-publish.yml diff --git a/.changes/config.json b/.changes/config.json new file mode 100644 index 00000000..d0b39cf0 --- /dev/null +++ b/.changes/config.json @@ -0,0 +1,171 @@ +{ + "gitSiteUrl": "https://github.com/tauri-apps/plugins-workspace/", + "pkgManagers": { + "javascript": { + "version": true, + "getPublishedVersion": "pnpm view ${ pkgFile.pkg.name } version", + "publish": ["pnpm build", "pnpm publish --access public --no-git-checks"] + }, + "rust": { + "version": true, + "getPublishedVersion": "cargo search ${ pkgFile.pkg.package.name } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -", + "publish": [ + { + "command": "cargo package --no-verify", + "dryRunCommand": true + }, + { + "command": "echo '
\n

Cargo Publish

\n\n```'", + "dryRunCommand": true, + "pipe": true + }, + { + "command": "cargo publish", + "dryRunCommand": "cargo publish --dry-run", + "pipe": true + }, + { + "command": "echo '```\n\n
\n'", + "dryRunCommand": true, + "pipe": true + } + ] + } + }, + "packages": { + "authenticator": { + "path": "./plugins/authenticator", + "manager": "" + }, + "authenticator-js": { + "path": "./plugins/authenticator", + "manager": "" + }, + + "autostart": { + "path": "./plugins/autostart", + "manager": "" + }, + "autostart-js": { + "path": "./plugins/autostart", + "manager": "" + }, + + "fs-extra": { + "path": "./plugins/fs-extra", + "manager": "" + }, + "fs-extra-js": { + "path": "./plugins/fs-extra", + "manager": "" + }, + + "fs-watch": { + "path": "./plugins/fs-watch", + "manager": "" + }, + "fs-watch-js": { + "path": "./plugins/fs-watch", + "manager": "" + }, + + "localhost": { + "path": "./plugins/localhost", + "manager": "rust" + }, + "localhost-js": { + "path": "./plugins/localhost", + "manager": "" + }, + + "log": { + "path": "./plugins/log", + "manager": "" + }, + "log-js": { + "path": "./plugins/log", + "manager": "" + }, + + "persisted-scope": { + "path": "./plugins/persisted-scope", + "manager": "rust" + }, + "persisted-scope-js": { + "path": "./plugins/persisted-scope", + "manager": "" + }, + + "positioner": { + "path": "./plugins/positioner", + "manager": "rust" + }, + "positioner-js": { + "path": "./plugins/positioner", + "manager": "" + }, + + "single-instance": { + "path": "./plugins/single-instance", + "manager": "" + }, + "single-instance-js": { + "path": "./plugins/single-instance", + "manager": "" + }, + + "sql": { + "path": "./plugins/sql", + "manager": "" + }, + "sql-js": { + "path": "./plugins/sql", + "manager": "" + }, + + "store": { + "path": "./plugins/store", + "manager": "" + }, + "store-js": { + "path": "./plugins/store", + "manager": "" + }, + + "stronghold": { + "path": "./plugins/stronghold", + "manager": "" + }, + "stronghold-js": { + "path": "./plugins/stronghold", + "manager": "" + }, + + "upload": { + "path": "./plugins/upload", + "manager": "" + }, + "upload-js": { + "path": "./plugins/upload", + "manager": "" + }, + + "websocket": { + "path": "./plugins/websocket", + "manager": "" + }, + "websocket-js": { + "path": "./plugins/websocket", + "manager": "" + }, + + "window-state": { + "path": "./plugins/window-state", + "manager": "rust" + }, + "window-state-js": { + "path": "./plugins/window-state", + "manager": "" + } + } +} diff --git a/.changes/readme.md b/.changes/readme.md new file mode 100644 index 00000000..002f4643 --- /dev/null +++ b/.changes/readme.md @@ -0,0 +1,30 @@ +# Changes + +##### via https://github.com/jbolda/covector + +As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend that it represents the overall change for organizational purposes. + +When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process. + +Use the following format: + +```md +--- +"package-a": patch +"package-b": minor +--- + +Change summary goes here +``` + +Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed. + +Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/). + +Given a version number MAJOR.MINOR.PATCH, increment the: + +- MAJOR version when you make incompatible API changes, +- MINOR version when you add functionality in a backwards compatible manner, and +- PATCH version when you make backwards compatible bug fixes. + +Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing). diff --git a/.github/sync-to-mirrors.sh b/.github/sync-to-mirrors.sh index 77252e0c..ab4405a7 100755 --- a/.github/sync-to-mirrors.sh +++ b/.github/sync-to-mirrors.sh @@ -60,6 +60,9 @@ fi # : > "$BUILD_BASE/changes.diff" +# Collect tags of current commit +readarray -t COMMIT_TAGS < <(git tag --points-at HEAD) + EXIT=0 while read -r PLUGIN_NAME; do printf "\n\n\e[7m Mirror: %s \e[0m\n" "$PLUGIN_NAME" @@ -106,6 +109,17 @@ while read -r PLUGIN_NAME; do # echo "$BUILD_BASE/changes.diff" # git show --pretty= --src-prefix="a/$PLUGIN_NAME/" --dst-prefix="b/$PLUGIN_NAME/" >> "$BUILD_BASE/changes.diff" echo "https://github.com/tauri-apps/tauri-plugin-$PLUGIN_NAME/commit/$(git rev-parse HEAD)" + + # Add new tags + for FULL_TAG in "${COMMIT_TAGS[@]}"; do + if [[ "$FULL_TAG" =~ ^"tauri-plugin-$PLUGIN_NAME-" ]]; then + TAG_NAME="${FULL_TAG#"tauri-plugin-$PLUGIN_NAME-"}" + echo "Creating tag $TAG_NAME" + git tag "${TAG_NAME}" -m "${GIT_CLI_COMMIT_MESSAGE}" + git push origin "${TAG_NAME}" + fi + done + echo "Completed $PLUGIN_NAME" else echo "::error::Commit of ${PLUGIN_NAME} failed" diff --git a/.github/workflows/covector-status.yml b/.github/workflows/covector-status.yml new file mode 100644 index 00000000..cb5a344a --- /dev/null +++ b/.github/workflows/covector-status.yml @@ -0,0 +1,16 @@ +name: covector status +on: [pull_request] + +jobs: + covector: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # required for use of git history + - name: covector status + uses: jbolda/covector/packages/action@covector-v0.8 + id: covector + with: + command: "status" diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml new file mode 100644 index 00000000..14057c07 --- /dev/null +++ b/.github/workflows/covector-version-or-publish.yml @@ -0,0 +1,59 @@ +name: version or publish + +on: + push: + branches: + - dev + +jobs: + version-or-publish: + runs-on: ubuntu-latest + timeout-minutes: 65 + outputs: + change: ${{ steps.covector.outputs.change }} + commandRan: ${{ steps.covector.outputs.commandRan }} + successfulPublish: ${{ steps.covector.outputs.successfulPublish }} + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # required for use of git history + + - uses: actions/setup-node@v3 + with: + node-version: "lts/*" + registry-url: "https://registry.npmjs.org" + + - uses: pnpm/action-setup@v2 + with: + version: 7.x.x + run_install: true + + - name: cargo login + run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }} + + - name: git config + run: | + git config --global user.name "${{ github.event.pusher.name }}" + git config --global user.email "${{ github.event.pusher.email }}" + + - name: covector version or publish (publish when no change files present) + uses: jbolda/covector/packages/action@covector-v0.8 + id: covector + env: + NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + command: "version-or-publish" + createRelease: true + + - name: Create Pull Request With Versions Bumped + id: cpr + uses: tauri-apps/create-pull-request@v3 + if: steps.covector.outputs.commandRan == 'version' + with: + title: "Publish New Versions" + commit-message: "publish new versions" + labels: "version updates" + branch: "release" + body: ${{ steps.covector.outputs.change }} diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index eeb90499..3e4e85f3 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -15,6 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + + - name: Fetch git tags + run: git fetch origin 'refs/tags/*:refs/tags/*' + - name: Cache pnpm modules uses: actions/cache@v3 with: @@ -22,15 +26,19 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}- + - uses: actions/setup-node@v3 with: node-version: 18 + - uses: pnpm/action-setup@v2 with: version: 7.x.x run_install: true + - name: Build packages run: pnpm build + - name: Sync run: .github/sync-to-mirrors.sh env: diff --git a/Cargo.lock b/Cargo.lock index 5b946caf..05dc5a93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4284,7 +4284,7 @@ dependencies = [ [[package]] name = "tauri-plugin-authenticator" -version = "0.1.0" +version = "0.0.0" dependencies = [ "authenticator", "base64 0.21.0", @@ -4303,7 +4303,7 @@ dependencies = [ [[package]] name = "tauri-plugin-autostart" -version = "0.1.0" +version = "0.0.0" dependencies = [ "auto-launch", "log", @@ -4315,7 +4315,7 @@ dependencies = [ [[package]] name = "tauri-plugin-fs-extra" -version = "0.1.0" +version = "0.0.0" dependencies = [ "log", "serde", @@ -4326,7 +4326,7 @@ dependencies = [ [[package]] name = "tauri-plugin-fs-watch" -version = "0.1.0" +version = "0.0.0" dependencies = [ "log", "notify", @@ -4352,7 +4352,7 @@ dependencies = [ [[package]] name = "tauri-plugin-log" -version = "0.1.0" +version = "0.0.0" dependencies = [ "byte-unit", "fern", @@ -4378,7 +4378,7 @@ dependencies = [ [[package]] name = "tauri-plugin-positioner" -version = "0.2.7" +version = "1.0.4" dependencies = [ "log", "serde", @@ -4390,7 +4390,7 @@ dependencies = [ [[package]] name = "tauri-plugin-single-instance" -version = "0.1.0" +version = "0.0.0" dependencies = [ "log", "serde", @@ -4403,7 +4403,7 @@ dependencies = [ [[package]] name = "tauri-plugin-sql" -version = "0.1.0" +version = "0.0.0" dependencies = [ "futures-core", "log", @@ -4418,7 +4418,7 @@ dependencies = [ [[package]] name = "tauri-plugin-store" -version = "0.1.0" +version = "0.0.0" dependencies = [ "log", "serde", @@ -4429,7 +4429,7 @@ dependencies = [ [[package]] name = "tauri-plugin-stronghold" -version = "0.1.0" +version = "0.0.0" dependencies = [ "hex", "iota-crypto 0.17.0", @@ -4446,7 +4446,7 @@ dependencies = [ [[package]] name = "tauri-plugin-upload" -version = "0.1.0" +version = "0.0.0" dependencies = [ "futures-util", "log", @@ -4462,7 +4462,7 @@ dependencies = [ [[package]] name = "tauri-plugin-websocket" -version = "0.1.0" +version = "0.0.0" dependencies = [ "futures-util", "log", diff --git a/plugins/authenticator/Cargo.toml b/plugins/authenticator/Cargo.toml index 042927ad..007e63f4 100644 --- a/plugins/authenticator/Cargo.toml +++ b/plugins/authenticator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-authenticator" -version = "0.1.0" +version = "0.0.0" description = "Use hardware security-keys in your Tauri App." authors.workspace = true license.workspace = true diff --git a/plugins/autostart/Cargo.toml b/plugins/autostart/Cargo.toml index dc42168d..8d0abc50 100644 --- a/plugins/autostart/Cargo.toml +++ b/plugins/autostart/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-autostart" -version = "0.1.0" +version = "0.0.0" description = "Automatically launch your application at startup." authors.workspace = true license.workspace = true diff --git a/plugins/fs-extra/Cargo.toml b/plugins/fs-extra/Cargo.toml index 79b0e7ce..3904ec59 100644 --- a/plugins/fs-extra/Cargo.toml +++ b/plugins/fs-extra/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-fs-extra" -version = "0.1.0" +version = "0.0.0" description = "Additional file system methods not included in the core API." authors.workspace = true license.workspace = true diff --git a/plugins/fs-watch/Cargo.toml b/plugins/fs-watch/Cargo.toml index f939dd2b..8431bae0 100644 --- a/plugins/fs-watch/Cargo.toml +++ b/plugins/fs-watch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-fs-watch" -version = "0.1.0" +version = "0.0.0" description = "Watch files and directories for changes." authors.workspace = true license.workspace = true diff --git a/plugins/log/Cargo.toml b/plugins/log/Cargo.toml index 94ad25f0..dfa72341 100644 --- a/plugins/log/Cargo.toml +++ b/plugins/log/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-log" -version = "0.1.0" +version = "0.0.0" description = "Configurable logging for your Tauri app." authors.workspace = true license.workspace = true diff --git a/plugins/positioner/Cargo.toml b/plugins/positioner/Cargo.toml index 08155a5d..dcab86c9 100644 --- a/plugins/positioner/Cargo.toml +++ b/plugins/positioner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-positioner" -version = "0.2.7" +version = "1.0.4" description = "Position your windows at well-known locations." authors.workspace = true license.workspace = true diff --git a/plugins/positioner/package.json b/plugins/positioner/package.json index 0ccdb528..83acb56f 100644 --- a/plugins/positioner/package.json +++ b/plugins/positioner/package.json @@ -1,6 +1,6 @@ { "name": "tauri-plugin-positioner-api", - "version": "0.0.0", + "version": "0.2.7", "description": "Position your windows at well-known locations.", "license": "MIT or APACHE-2.0", "authors": [ diff --git a/plugins/single-instance/Cargo.toml b/plugins/single-instance/Cargo.toml index dbff7677..be46f3aa 100644 --- a/plugins/single-instance/Cargo.toml +++ b/plugins/single-instance/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-single-instance" -version = "0.1.0" +version = "0.0.0" description = "Ensure a single instance of your tauri app is running." authors.workspace = true license.workspace = true diff --git a/plugins/sql/Cargo.toml b/plugins/sql/Cargo.toml index 502cd12c..91a839ac 100644 --- a/plugins/sql/Cargo.toml +++ b/plugins/sql/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-sql" -version = "0.1.0" +version = "0.0.0" description = "Interface with SQL databases." authors.workspace = true license.workspace = true diff --git a/plugins/store/Cargo.toml b/plugins/store/Cargo.toml index 9fd091fc..626dbebc 100644 --- a/plugins/store/Cargo.toml +++ b/plugins/store/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-store" -version = "0.1.0" +version = "0.0.0" description = "Simple, persistent key-value store." authors.workspace = true license.workspace = true diff --git a/plugins/stronghold/Cargo.toml b/plugins/stronghold/Cargo.toml index 8d3d72d2..fb3ac3b8 100644 --- a/plugins/stronghold/Cargo.toml +++ b/plugins/stronghold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-stronghold" -version = "0.1.0" +version = "0.0.0" description = "Store secrets and keys using the IOTA Stronghold encrypted database." authors.workspace = true license.workspace = true diff --git a/plugins/upload/Cargo.toml b/plugins/upload/Cargo.toml index 985645d6..49abc6d4 100644 --- a/plugins/upload/Cargo.toml +++ b/plugins/upload/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-upload" -version = "0.1.0" +version = "0.0.0" description = "Upload files from disk to a remote server over HTTP." authors.workspace = true license.workspace = true diff --git a/plugins/websocket/Cargo.toml b/plugins/websocket/Cargo.toml index 38c1dc8b..37eafb5d 100644 --- a/plugins/websocket/Cargo.toml +++ b/plugins/websocket/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin-websocket" -version = "0.1.0" +version = "0.0.0" authors.workspace = true license.workspace = true edition.workspace = true diff --git a/plugins/window-state/package.json b/plugins/window-state/package.json index db80c491..f7938586 100644 --- a/plugins/window-state/package.json +++ b/plugins/window-state/package.json @@ -1,6 +1,6 @@ { "name": "tauri-plugin-window-state-api", - "version": "0.1.0", + "version": "0.0.0", "description": "Save window positions and sizes and restore them when the app is reopened.", "license": "MIT or APACHE-2.0", "authors": [