chore: implement covector publish (#845)

* add covector to root

* add workflow to covector config

* bump covector

* add webkit install on publish

* create workflow to version and publish

* remove workflows no longer needed

* add repo info to root package.json

* add early exits based on new output

* switch to dry run version of publish commands

* latest branch is being removed in this PR

* add summary component around yarn audit
This commit is contained in:
Jacob Bolda 2020-07-19 15:33:12 -05:00 committed by GitHub
parent 0f00384152
commit 2d721324a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 232 additions and 316 deletions

View File

@ -3,18 +3,152 @@
"pkgManagers": {
"rust": {
"version": true,
"publish": false
"getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y webkit2gtk-4.0",
{
"command": "cargo generate-lockfile",
"dryRunCommand": true,
"runFromRoot": true,
"pipe": true
},
{
"command": "echo \"# Cargo Audit\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "cargo audit",
"dryRunCommand": true,
"runFromRoot": true,
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "cargo package --no-verify --allow-dirty",
"dryRunCommand": true,
"pipe": true
}
],
"publish": [
{
"command": "echo \"# Cargo Publish\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "cargo publish --no-verify",
"dryRunCommand": "cargo publish --no-verify --dry-run",
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
}
],
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
"git push --tags -f"
],
"assets": [
{
"path": "${ pkg.path }/${ pkg.pkg }-${ pkgFile.version }.crate",
"name": "${ pkg.pkg }-${ pkgFile.version }.crate"
}
]
},
"javascript": {
"version": true,
"publish": false
"getPublishedVersion": "npm view ${ pkgFile.pkg.name } version",
"prepublish": [
{
"command": "yarn",
"dryRunCommand": true
},
{
"command": "echo \"# Yarn Audit\n\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "echo \"<details>\n<summary>click to view</summary>\n\n\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn audit",
"dryRunCommand": true,
"runFromRoot": true,
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\n\n</details>\n\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "npm pack",
"dryRunCommand": true,
"pipe": true
}
],
"publish": [
{
"command": "echo \"# NPM Package Publish\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "npm publish --access public",
"dryRunCommand": "npm publish --dry-run --access public",
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
}
],
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
"git push --tags -f"
]
}
},
"packages": {
"tauri.js": {
"path": "./cli/tauri.js",
"manager": "javascript",
"dependencies": ["tauri"]
"dependencies": ["tauri"],
"assets": [
{
"path": "./cli/tauri.js/tauri-${ pkgFile.version }.tgz",
"name": "tauri.js-${ pkgFile.version }.tgz"
}
]
},
"tauri-bundler": {
"path": "./cli/tauri-bundler",
@ -36,7 +170,8 @@
},
"tauri-updater": {
"path": "./tauri-updater",
"manager": "rust"
"manager": "rust",
"publish": false
}
}
}

View File

@ -30,7 +30,6 @@ If yes, please describe the impact and migration path for existing applications
**The PR fulfills these requirements:**
- [ ] It's submitted to the `dev` branch and _not_ the `latest` branch
- [ ] When resolving a specific issue, it's referenced in the PR's title (e.g. `fix: #xxx[,#xxx]`, where "xxx" is the issue number)
- [ ] A change file is added if any packages will require a version bump due to this PR per [the instructions in the readme](https://github.com/tauri-apps/tauri/blob/dev/.changes/readme.md).

View File

@ -0,0 +1,77 @@
name: release-npm
on:
push:
branches:
- dev
jobs:
version-or-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'
- name: cargo login
run: cargo login ${{ secrets.crate_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
uses: jbolda/covector/packages/action@covector-v0
id: covector
with:
command: 'version-or-publish'
- name: Create Pull Request With Versions Bumped
if: ${{ steps.covector.outputs.command }} == 'version'
uses: tauri-apps/create-pull-request@v2.8.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: release/version-updates
title: Apply Version Updates From Current Changes
commit-message: "apply version updates"
labels: "version updates"
body: ${{ steps.covector.outputs.change }}
tangle:
runs-on: ubuntu-latest
needs: version-or-publish
if: ${{ needs.version-or-publish.outputs.covector.successfulPublish }} == 'true'
strategy:
fail-fast: false
matrix:
package:
- name: tauri.js
registryName: tauri
- name: tauri-bundler
registryName: tauri-bundler
- name: tauri-utils
registryName: tauri-utils
- name: tauri-api
registryName: tauri-api
- name: tauri-updater
registryName: tauri-updater
- name: tauri-core
registryName: tauri
steps:
- uses: actions/checkout@v2
- run: echo ::set-env name=PUBLISHED::$(jq '.${{ matrix.package.name }}.command' ${{ needs.version-or-publish.outputs.covector.change }})
- run: echo ::set-env name=PACKAGE_VERSION::$(jq '.${{ matrix.package.name }}.pkg.pkgFile.version' ${{ needs.version-or-publish.outputs.covector.change }})
- name: Tangle Release
if: env.PUBLISHED != 'false' && !startsWith(env.PUBLISHED, "parse error") && !startsWith(env.PACKAGE_VERSION, "parse error")
id: tangle_release
uses: iotaledger/gh-tangle-release@v0.6.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IOTA_SEED: ${{ secrets.IOTA_SEED }}
IOTA_NODE: "https://iotanode.us:14267"
with:
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
comment: "Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }} [npmjs.com]"

View File

@ -1,34 +0,0 @@
name: pr-to-latest
on:
push:
branches:
- dev
jobs:
pr-to-latest:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, 'version updates')
steps:
- uses: actions/checkout@v2
with:
ref: latest
fetch-depth: 0
- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"
- run: git fetch origin dev
- run: git merge -Xours ${{ github.sha }}
- name: Create Pull Request
uses: tauri-apps/create-pull-request@v2.8.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: ${{ github.event.head_commit.message }}
branch: release/latest
branch-suffix: short-commit-hash
title: Publish
labels: "publish"
body: |
Merging this PR will squash and push all changes to the latest branch.
It will kick off the process to release and publish any packages with an incremented version number.

View File

@ -1,33 +0,0 @@
name: pr-version-updates
on:
push:
branches:
- dev
jobs:
pr-to-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- 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
uses: jbolda/covector/packages/action@covector-v0
id: covector
with:
command: 'version'
- name: Create Pull Request With Versions Bumped
uses: tauri-apps/create-pull-request@v2.8.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: release/version-updates
title: Apply Version Updates From Current Changes
commit-message: "apply version updates"
labels: "version updates"
body: ${{ steps.covector.outputs.change }}

View File

@ -1,137 +0,0 @@
name: release-cargo
on:
push:
branches:
- latest
paths:
- '**/Cargo.toml'
- '.github/workflows/**'
jobs:
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
package:
- name: tauri-bundler
registryName: tauri-bundler
path: cli/tauri-bundler
publishPath: cli/tauri-bundler/target/package # not in workspace so target folder is nested
auditPath: cli/tauri-bundler
- name: tauri-utils
registryName: tauri-utils
path: tauri-utils
publishPath: target/package
auditPath: ./
- name: tauri-api
registryName: tauri-api
path: tauri-api
publishPath: target/package
auditPath: ./
- name: tauri-updater
registryName: tauri-updater
path: tauri-updater
publishPath: target/package
auditPath: ./
- name: tauri-core
registryName: tauri
path: tauri
publishPath: target/package
auditPath: ./
steps:
- uses: actions/checkout@v2
with:
ref: latest
toolchain: stable
- name: get version
working-directory: ${{ matrix.package.path }}
run: echo ::set-env name=PACKAGE_VERSION::$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml)
- name: check published version
run: echo ::set-env name=PUBLISHED_VERSION::$(cargo search ${{ matrix.package.registryName }} --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -)
- name: install webkit2gtk
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- name: cargo login
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
run: cargo login ${{ secrets.crate_token }}
- name: cargo generate-lockfile (for audit)
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.auditPath }}
env:
TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/dist
TAURI_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/src-tauri
run: |
echo "This is only for the audit. Lock files are listed in the gitignore so it should not be published."
cargo generate-lockfile
- name: cargo package
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
env:
TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/dist
TAURI_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/src-tauri
run: |
cargo package --no-verify
echo "We will publish:" $PACKAGE_VERSION
echo "This is current latest:" $PUBLISHED_VERSION
- name: cargo audit
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.auditPath }}
env:
TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/dist
TAURI_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/src-tauri
run: |
cargo install cargo-audit
echo "# Cargo Audit" | tee -a ${{runner.workspace }}/notes.md
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
cargo audit 2>&1 | tee -a ${{runner.workspace }}/notes.md
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
- name: Publish ${{ matrix.package.name }}
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
env:
TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/dist
TAURI_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/src-tauri
run: |
echo "# Cargo Publish" | tee -a ${{runner.workspace }}/notes.md
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
set -o pipefail && cargo publish --no-verify 2>&1 | tee -a ${{runner.workspace }}/notes.md
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
- name: Create Release
id: create_crate_release
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
uses: jbolda/create-release@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
release_name: "Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }} [crates.io]"
bodyFromFile: ./../notes.md
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_crate_release.outputs.upload_url }}
asset_path: ./${{ matrix.package.publishPath }}/${{ matrix.package.registryName }}-${{ env.PACKAGE_VERSION }}.crate
asset_name: ${{ matrix.package.registryName }}-${{ env.PACKAGE_VERSION }}.crate
asset_content_type: application/x-gtar
- name: Tangle Release
id: tangle_release
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
uses: iotaledger/gh-tangle-release@v0.6.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IOTA_SEED: ${{ secrets.IOTA_SEED }}
IOTA_NODE: "https://iotanode.us:14267"
with:
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
comment: "Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }} [crates.io]"

View File

@ -1,106 +0,0 @@
name: release-npm
on:
push:
branches:
- latest
paths:
- '**/package.json'
- '.github/workflows/**'
jobs:
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- name: tauri.js
registryName: tauri
path: cli/tauri.js
steps:
- uses: actions/checkout@v2
with:
ref: latest
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'
- name: get version
working-directory: ${{ matrix.package.path }}
run: echo ::set-env name=PACKAGE_VERSION::$(node -p "require('./package.json').version")
- name: check published version
run: echo ::set-env name=PUBLISHED_VERSION::$(npm view ${{ matrix.package.registryName }} version)
- name: yarn install
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
run: yarn
- name: npm pack
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
run: |
echo "pack dir:"
ls
npm pack
echo "We will publish:" $PACKAGE_VERSION
echo "This is current latest:" $PUBLISHED_VERSION
echo "post pack dir:"
ls
- name: yarn audit
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
run: |
echo "# Yarn Audit Results" | tee -a ${{runner.workspace }}/notes.md
echo "" >> ${{runner.workspace }}/notes.md
echo "<details>" >> ${{runner.workspace }}/notes.md
echo "<summary>click to view</summary>" >> ${{runner.workspace }}/notes.md
echo "" >> ${{runner.workspace }}/notes.md
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
yarn audit 2>&1 | tee -a ${{runner.workspace }}/notes.md
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
echo "</details>" >> ${{runner.workspace }}/notes.md
echo "" >> ${{runner.workspace }}/notes.md
- name: Publish ${{ matrix.package.name }}
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
working-directory: ${{ matrix.package.path }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "# NPM Package Publish" | tee -a ${{runner.workspace }}/notes.md
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
set -o pipefail && npm publish 2>&1 | tee -a ${{runner.workspace }}/notes.md
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
- name: Create Release
id: create_npm_release
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
uses: jbolda/create-release@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
release_name: "Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }} [npmjs.com]"
bodyFromFile: ./../notes.md
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_npm_release.outputs.upload_url }}
asset_path: ./${{ matrix.package.path }}/${{ matrix.package.registryName }}-${{ env.PACKAGE_VERSION }}.tgz
asset_name: ${{ matrix.package.registryName }}-${{ env.PACKAGE_VERSION }}.tgz
asset_content_type: application/x-gtar
- name: Tangle Release
id: tangle_release
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
uses: iotaledger/gh-tangle-release@v0.6.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IOTA_SEED: ${{ secrets.IOTA_SEED }}
IOTA_NODE: "https://iotanode.us:14267"
with:
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
comment: "Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }} [npmjs.com]"

3
.gitignore vendored
View File

@ -75,8 +75,9 @@ TODO.md
# rust compiled folders
target
# Cargo lock for libs
# lock for libs
Cargo.lock
yarn.lock
/cli/tauri.js/test/jest/tmp

14
package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "tauri-workspace",
"version": "0.0.0",
"license": "MIT",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/tauri-apps/tauri.git",
"directory": "cli/tauri.js"
},
"devDependencies": {
"covector": "^0.2.6"
}
}