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
This commit is contained in:
Fabian-Lars
2023-04-25 17:31:33 +02:00
committed by GitHub
parent 9e97a55d85
commit 3fddf476de
21 changed files with 324 additions and 26 deletions
+14
View File
@@ -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"
+16
View File
@@ -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"
@@ -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 }}
+8
View File
@@ -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: