mirror of
https://github.com/vrc-get/vrc-get.git
synced 2026-06-21 09:58:08 +00:00
ci: test apple script
This commit is contained in:
parent
b2f9d84909
commit
b256be46cf
2 changed files with 13 additions and 465 deletions
470
.github/workflows/publish-gui.yml
vendored
470
.github/workflows/publish-gui.yml
vendored
|
|
@ -1,472 +1,12 @@
|
|||
name: Publish (GUI)
|
||||
name: Apple Script Test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_kind:
|
||||
type: choice
|
||||
description: The type of release.
|
||||
default: prerelease
|
||||
required: true
|
||||
options:
|
||||
- prerelease
|
||||
- start-rc
|
||||
- stable
|
||||
dry-run:
|
||||
type: boolean
|
||||
description: Dry Run, If true, do not publish release to GitHub.
|
||||
default: true
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
pre-build:
|
||||
name: Update version name
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
gui-version: ${{ env.GUI_VERSION }}
|
||||
prerelease: ${{ steps.update-version.outputs.prerelease }}
|
||||
permissions:
|
||||
contents: write
|
||||
run-test:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: anatawa12/something-releaser@v3
|
||||
- uses: snow-actions/git-config-user@v1.0.0
|
||||
- run: rustup update stable
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Update Version Name
|
||||
id: update-version
|
||||
run: |
|
||||
# set version name in properties file
|
||||
case "$RELEASE_KIND_IN" in
|
||||
"prerelease" )
|
||||
get-version -t gui | version-next | set-version -t gui
|
||||
gh-export-variable PRERELEASE true
|
||||
gh-set-output prerelease true
|
||||
;;
|
||||
"start-rc" )
|
||||
get-version -t gui | version-set-channel - rc 0 | set-version -t gui
|
||||
gh-export-variable PRERELEASE true
|
||||
gh-set-output prerelease true
|
||||
;;
|
||||
"stable" )
|
||||
get-version -t gui | version-set-channel - stable | set-version -t gui
|
||||
gh-export-variable PRERELEASE false
|
||||
gh-set-output prerelease '' # empty string for false
|
||||
;;
|
||||
* )
|
||||
echo "invalid release kind: $RELEASE_KIND_IN"
|
||||
exit 255
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$GITHUB_REF_NAME" in
|
||||
master | master-* )
|
||||
echo "head is master or master-*"
|
||||
;;
|
||||
* )
|
||||
if [ "$DRY_RUN" = "true" ]; then
|
||||
echo "head is not master, but DRY_RUN is true"
|
||||
else
|
||||
echo "head is not master, but DRY_RUN is false"
|
||||
exit 255
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
gh-export-variable GUI_VERSION "$(get-version -t gui)"
|
||||
env:
|
||||
RELEASE_KIND_IN: ${{ inputs.release_kind }}
|
||||
DRY_RUN: ${{ inputs.dry-run }}
|
||||
|
||||
# region changelog
|
||||
- name: Create Changelog
|
||||
id: changelog
|
||||
uses: anatawa12/sh-actions/changelog/prepare-release@master
|
||||
with:
|
||||
path: CHANGELOG-gui.md
|
||||
version: ${{ env.GUI_VERSION }}
|
||||
prerelease: ${{ env.PRERELEASE }}
|
||||
tag-prefix: gui-v
|
||||
prerelease-note-heading: |
|
||||
Version ${{ env.GUI_VERSION }}
|
||||
---
|
||||
release-note-heading: |
|
||||
Version ${{ env.GUI_VERSION }}
|
||||
---
|
||||
- name: Upload CHANGELOG.md
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CHANGELOG
|
||||
path: CHANGELOG.md
|
||||
- name: copy release note
|
||||
run: cp "${{ steps.changelog.outputs.release-note }}" release-note.md
|
||||
- name: Upload release note
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-note-for-release
|
||||
path: release-note.md
|
||||
- name: remove temp release note file
|
||||
run: rm release-note.md
|
||||
# endregion changelog
|
||||
|
||||
- name: Commit
|
||||
id: update
|
||||
run: |-
|
||||
# commit & tag
|
||||
git commit -am "gui v$GUI_VERSION"
|
||||
git branch releasing
|
||||
git push -f -u origin releasing
|
||||
|
||||
build-web:
|
||||
name: Build gui web
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ pre-build ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'releasing'
|
||||
submodules: recursive
|
||||
|
||||
- run: npm run build
|
||||
working-directory: vrc-get-gui
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: vrc-get-gui-web
|
||||
path: vrc-get-gui/out
|
||||
|
||||
build-rust:
|
||||
name: Build rust
|
||||
environment:
|
||||
name: actions-code-signing
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# note: when you changed paths for tauri updater (which are files with .sig),
|
||||
# remember keep in sync with build-updater-json
|
||||
- triple: x86_64-unknown-linux-gnu
|
||||
on: ubuntu-22.04
|
||||
setup: |
|
||||
sudo apt update && sudo apt install -y lld
|
||||
ld.lld --version
|
||||
|
||||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
||||
rustflags: "-C link-arg=-fuse-ld=lld"
|
||||
dist-path: |
|
||||
bundle/appimage/ALCOM_${GUI_VERSION}_amd64.AppImage:alcom-${GUI_VERSION}-x86_64.AppImage
|
||||
|
||||
bundle/appimage/ALCOM_${GUI_VERSION}_amd64.AppImage.tar.gz:alcom-${GUI_VERSION}-x86_64.AppImage.tar.gz
|
||||
bundle/appimage/ALCOM_${GUI_VERSION}_amd64.AppImage.tar.gz.sig:alcom-${GUI_VERSION}-x86_64.AppImage.tar.gz.sig
|
||||
|
||||
bundle/deb/ALCOM_${GUI_VERSION}_amd64.deb:alcom_${GUI_VERSION}_amd64.deb
|
||||
bundle/rpm/ALCOM-${GUI_VERSION}-1.x86_64.rpm:alcom-${GUI_VERSION}-1.x86_64.rpm
|
||||
|
||||
- triple: x86_64-pc-windows-msvc
|
||||
on: windows-latest
|
||||
esigner: true
|
||||
dist-path: |
|
||||
ALCOM.exe:ALCOM-${GUI_VERSION}-x86_64.exe
|
||||
bundle/nsis/ALCOM_${GUI_VERSION}_x64-setup.exe:ALCOM-${GUI_VERSION}-x86_64-setup.exe
|
||||
bundle/nsis/ALCOM_${GUI_VERSION}_x64-setup.nsis.zip:ALCOM-${GUI_VERSION}-x86_64-setup.nsis.zip
|
||||
bundle/nsis/ALCOM_${GUI_VERSION}_x64-setup.nsis.zip.sig:ALCOM-${GUI_VERSION}-x86_64-setup.nsis.zip.sig
|
||||
|
||||
- triple: universal-apple-darwin
|
||||
on: macos-14
|
||||
setup: |
|
||||
rustup target add aarch64-apple-darwin
|
||||
rustup target add x86_64-apple-darwin
|
||||
dist-path: |
|
||||
bundle/dmg/ALCOM_${GUI_VERSION}_universal.dmg:ALCOM-${GUI_VERSION}-universal.dmg
|
||||
|
||||
bundle/macos/ALCOM.app.tar.gz:ALCOM-${GUI_VERSION}-universal.app.tar.gz
|
||||
bundle/macos/ALCOM.app.tar.gz.sig:ALCOM-${GUI_VERSION}-universal.app.tar.gz.sig
|
||||
|
||||
triple:
|
||||
- x86_64-unknown-linux-gnu
|
||||
#- aarch64-unknown-linux-musl
|
||||
- x86_64-pc-windows-msvc
|
||||
#- aarch64-pc-windows-msvc
|
||||
- universal-apple-darwin
|
||||
|
||||
runs-on: ${{ matrix.on }}
|
||||
env:
|
||||
RUSTFLAGS: ${{ matrix.rustflags }}
|
||||
# workaround of https://github.com/tauri-apps/tauri-action/issues/1091
|
||||
TAURI_BUNDLER_DMG_IGNORE_CI: false
|
||||
|
||||
needs: [ pre-build, build-web ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'releasing'
|
||||
submodules: recursive
|
||||
- run: rustup update stable
|
||||
- name: Install cross-compilation tools
|
||||
uses: taiki-e/setup-cross-toolchain-action@v1
|
||||
if: ${{ matrix.triple != 'universal-apple-darwin' }}
|
||||
with:
|
||||
target: ${{ matrix.triple }}
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-targets: false # for release build, do not cache build artifacts
|
||||
key: release-gui # there are no elements about build result, so it's ok to share between all builds
|
||||
|
||||
- name: Setup
|
||||
run: ${{ matrix.setup }}
|
||||
|
||||
- uses: anatawa12/setup-eSigner-CKA@v1
|
||||
if: ${{ matrix.esigner }}
|
||||
with:
|
||||
mode: ${{ vars.WIN_ESIGNER_MODE }}
|
||||
username: ${{ secrets.WIN_ESIGNER_USERNAME }}
|
||||
password: ${{ secrets.WIN_ESIGNER_PASSWORD }}
|
||||
totp-secret: ${{ secrets.WIN_ESIGNER_TOTP_SECRET }}
|
||||
|
||||
- name: Download Web Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: vrc-get-gui-web
|
||||
path: vrc-get-gui/out
|
||||
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
# apple code signing
|
||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
|
||||
# tauri updater signing
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||||
|
||||
# we have to use x86 version of signtool since eSignerCKA does not work with x64 version
|
||||
TAURI_WINDOWS_SIGNTOOL_PATH: C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe
|
||||
|
||||
with:
|
||||
projectPath: vrc-get-gui
|
||||
tauriScript: npm run tauri
|
||||
# disable beforeBuildCommand since we already build web
|
||||
args: |
|
||||
--target ${{ matrix.triple }} -c '{"build":{"beforeBuildCommand":null}}'
|
||||
|
||||
- name: Move artifacts
|
||||
shell: bash
|
||||
env:
|
||||
GUI_VERSION: ${{ needs.pre-build.outputs.gui-version }}
|
||||
DIST_PATH: ${{ matrix.dist-path }}
|
||||
run: |-
|
||||
mkdir artifacts
|
||||
|
||||
echo "$DIST_PATH" | while IFS=: read -r src dst; do
|
||||
src="${src//\$\{GUI_VERSION\}/$GUI_VERSION}"
|
||||
dst="${dst//\$\{GUI_VERSION\}/$GUI_VERSION}"
|
||||
if [ -z "$dst" ]; then
|
||||
continue
|
||||
fi
|
||||
printf "mv %s %s\n" "target/${{ matrix.triple }}/release/$src" "artifacts/$dst"
|
||||
mv "target/${{ matrix.triple }}/release/$src" "artifacts/$dst"
|
||||
done
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifacts-${{ matrix.triple }}
|
||||
path: artifacts/*
|
||||
|
||||
build-updater-json:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ pre-build, build-rust ]
|
||||
steps:
|
||||
# use release
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Download All Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: assets
|
||||
pattern: artifacts-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Run updater-json
|
||||
env:
|
||||
GUI_VERSION: ${{ needs.pre-build.outputs.gui-version }}
|
||||
run: cargo run -p build-updater-json
|
||||
|
||||
- name: Upload updater-json
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: updater.json
|
||||
path: |
|
||||
updater.json
|
||||
updater-beta.json
|
||||
|
||||
publish-to-github:
|
||||
name: Publish to GitHub
|
||||
if: ${{ !inputs.dry-run }}
|
||||
environment:
|
||||
name: actions-github-app
|
||||
url: https://github.com/anatawa12/vrc-get/releases/gui-v${{ needs.pre-build.outputs.gui-version }}
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ pre-build, build-rust, build-updater-json ]
|
||||
env:
|
||||
GUI_VERSION: ${{ needs.pre-build.outputs.gui-version }}
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ secrets.APP_ID }}
|
||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'releasing'
|
||||
fetch-depth: 2
|
||||
submodules: recursive
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
|
||||
# tools
|
||||
- uses: anatawa12/something-releaser@v3
|
||||
- uses: snow-actions/git-config-user@v1.0.0
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Download All Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: assets
|
||||
pattern: artifacts-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Download changelog
|
||||
# if: ${{ !needs.pre-build.outputs.prerelease }}
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-note-for-release
|
||||
path: changelog
|
||||
|
||||
- name: Push tag
|
||||
run: |-
|
||||
# set tag and publish current version
|
||||
git tag "gui-v$GUI_VERSION"
|
||||
git push --tags
|
||||
# create master and push
|
||||
git switch -c master
|
||||
git fetch origin master --depth=1
|
||||
git log --all --graph
|
||||
git push -u origin master
|
||||
sleep 1
|
||||
|
||||
- name: create release
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |-
|
||||
# latest = false because we need to have vrc-get cli in the latest release
|
||||
# always generating notes file for now
|
||||
# ${{ !needs.pre-build.outputs.prerelease && '--notes-file changelog/release-note.md' || '' }} \
|
||||
gh release create \
|
||||
${{ needs.pre-build.outputs.prerelease && '--prerelease' || '' }} \
|
||||
--latest=false \
|
||||
--notes-file changelog/release-note.md \
|
||||
--verify-tag "gui-v$GUI_VERSION" \
|
||||
assets/*
|
||||
|
||||
rm -rf outputs assets
|
||||
|
||||
- name: prepare next release & push
|
||||
if: ${{ !needs.pre-build.outputs.prerelease }}
|
||||
run: |
|
||||
get-version -t gui | version-next | version-set-channel - beta 0 | set-version -t gui
|
||||
GUI_NEXT="$(get-version -t gui | version-stable)"
|
||||
git commit -am "chore: prepare for next version: gui $GUI_NEXT"
|
||||
git push
|
||||
|
||||
cleanup:
|
||||
name: Cleanup
|
||||
if: ${{ !failure() && !cancelled() }}
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- pre-build
|
||||
- build-rust
|
||||
- publish-to-github
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: 'releasing'
|
||||
fetch-depth: 2
|
||||
- name: remove releasing branch
|
||||
run: git push --delete origin releasing
|
||||
|
||||
pull-request-to-website:
|
||||
name: Create PullRequest to vrc-get.anatawa12.com for updater.json
|
||||
if: ${{ !inputs.dry-run }}
|
||||
environment:
|
||||
name: actions-github-app
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ pre-build, build-updater-json ]
|
||||
env:
|
||||
GUI_VERSION: ${{ needs.pre-build.outputs.gui-version }}
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ secrets.APP_ID }}
|
||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
owner: vrc-get
|
||||
repositories: vrc-get.anatawa12.com
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'vrc-get/vrc-get.anatawa12.com'
|
||||
ref: 'master'
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
|
||||
- uses: snow-actions/git-config-user@v1.0.0
|
||||
|
||||
- name: Download updater.json
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: updater.json
|
||||
path: .
|
||||
- name: Move updater.json
|
||||
env:
|
||||
STABLE: ${{ !needs.pre-build.outputs.prerelease }}
|
||||
run: |
|
||||
mkdir -p public/api/gui
|
||||
if $STABLE; then
|
||||
rm public/api/gui/tauri-updater.json || true # remove old file if exists
|
||||
mv updater.json public/api/gui/tauri-updater.json
|
||||
fi
|
||||
rm public/api/gui/tauri-updater-beta.json || true
|
||||
mv updater-beta.json public/api/gui/tauri-updater-beta.json
|
||||
|
||||
- name: Commit
|
||||
run: |-
|
||||
BRANCH_NAME="update-tauri-updater-json-v$GUI_VERSION"
|
||||
git switch -c "$BRANCH_NAME"
|
||||
git add public/api/gui/tauri-updater.json public/api/gui/tauri-updater-beta.json
|
||||
git commit -m "chore: update tauri-updater.json to v$GUI_VERSION"
|
||||
git push -u origin "$BRANCH_NAME"
|
||||
|
||||
- name: Create Pull Request
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
run: |
|
||||
BRANCH_NAME="update-tauri-updater-json-v$GUI_VERSION"
|
||||
|
||||
gh pr create \
|
||||
--title "chore: update tauri-updater.json to v$GUI_VERSION" \
|
||||
--body "update tauri-updater.json to v$GUI_VERSION" \
|
||||
--base master \
|
||||
--head "$BRANCH_NAME" \
|
||||
--assignee anatawa12 \
|
||||
- name: Run test AppleScript
|
||||
run: osascript test.applescript "$(pwd)"
|
||||
|
|
|
|||
8
test.applescript
Normal file
8
test.applescript
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env osascript
|
||||
|
||||
on run (folderName)
|
||||
tell application "Finder"
|
||||
activate
|
||||
open folder folderName
|
||||
end tell
|
||||
end run
|
||||
Loading…
Add table
Add a link
Reference in a new issue