mirror of
https://github.com/vrc-get/vrc-get.git
synced 2026-06-21 09:58:08 +00:00
ci(gui): add cd for gui
This commit is contained in:
parent
0ae0331b9a
commit
61a3768f07
2 changed files with 305 additions and 0 deletions
302
.github/workflows/publish-gui.yml
vendored
Normal file
302
.github/workflows/publish-gui.yml
vendored
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
name: Publish (GUI)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_kind:
|
||||
type: choice
|
||||
description: The type of release.
|
||||
default: prerelease
|
||||
required: true
|
||||
options:
|
||||
- prerelease
|
||||
- start-rc
|
||||
- stable
|
||||
|
||||
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
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: anatawa12/something-releaser@v3
|
||||
- uses: snow-actions/git-config-user@v1.0.0
|
||||
- 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-*"
|
||||
;;
|
||||
* )
|
||||
echo "invalid release kind: $RELEASE_KIND_IN is not allowd for $GITHUB_REF_NAME"
|
||||
exit 255
|
||||
;;
|
||||
esac
|
||||
|
||||
gh-export-variable GUI_VERSION "$(get-version -t gui)"
|
||||
env:
|
||||
RELEASE_KIND_IN: ${{ github.event.inputs.release_kind }}
|
||||
|
||||
# region changelog
|
||||
- name: Create Changelog
|
||||
id: changelog
|
||||
if: ${{ !steps.update-version.outputs.prerelease }}
|
||||
uses: anatawa12/sh-actions/changelog/prepare-release@master #TODO
|
||||
with:
|
||||
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
|
||||
if: ${{ !steps.update-version.outputs.prerelease }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: CHANGELOG
|
||||
path: CHANGELOG.md
|
||||
- name: copy release note
|
||||
if: ${{ !steps.update-version.outputs.prerelease }}
|
||||
run: cp "${{ steps.changelog.outputs.release-note }}" release-note.md
|
||||
- name: Upload release note
|
||||
if: ${{ !steps.update-version.outputs.prerelease }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-note-for-release
|
||||
path: release-note.md
|
||||
- name: remove temp release note file
|
||||
if: ${{ !steps.update-version.outputs.prerelease }}
|
||||
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-rust:
|
||||
name: Build rust
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- triple: x86_64-unknown-linux-gnu
|
||||
on: ubuntu-latest
|
||||
setup: |
|
||||
sudo apt update && sudo apt install -y lld
|
||||
ld.lld --version
|
||||
|
||||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
|
||||
rustflags: "-C link-arg=-fuse-ld=lld"
|
||||
dist-paths: |
|
||||
bundle/appimage/vrc-get-gui_${GUI_VERSION}_amd64.AppImage:vrc-get-gui-${GUI_VERSION}-x86_64.AppImage
|
||||
|
||||
- triple: x86_64-pc-windows-msvc
|
||||
on: windows-latest
|
||||
dist-paths: |
|
||||
vrc-get-gui.exe:vrc-get-gui-${GUI_VERSION}-x86_64.exe
|
||||
bundle/nsis/vrc-get-gui_${GUI_VERSION}_x64-setup.exe:vrc-get-gui-${GUI_VERSION}-x86_64-setup.exe
|
||||
|
||||
|
||||
- triple: x86_64-apple-darwin
|
||||
on: macos-latest
|
||||
dist-path: |
|
||||
bundle/dmg/vrc-get-gui_${GUI_VERSION}_x64.dmg:vrc-get-gui-${GUI_VERSION}-x86_64.dmg
|
||||
|
||||
- triple: aarch64-apple-darwin
|
||||
on: macos-14
|
||||
dist-path: |
|
||||
bundle/dmg/vrc-get-gui_${GUI_VERSION}_aarch64.dmg:vrc-get-gui-${GUI_VERSION}-aarch64.dmg
|
||||
|
||||
triple:
|
||||
- x86_64-unknown-linux-gnu
|
||||
#- aarch64-unknown-linux-musl
|
||||
- x86_64-pc-windows-msvc
|
||||
#- aarch64-pc-windows-msvc
|
||||
- x86_64-apple-darwin
|
||||
- aarch64-apple-darwin
|
||||
|
||||
runs-on: ${{ matrix.on }}
|
||||
env:
|
||||
RUSTFLAGS: ${{ matrix.rustflags }}
|
||||
|
||||
needs: [pre-build]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: 'releasing'
|
||||
submodules: recursive
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.triple }}
|
||||
- name: Install cross-compilation tools
|
||||
uses: taiki-e/setup-cross-toolchain-action@v1
|
||||
with:
|
||||
target: ${{ matrix.triple }}
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-targets: false # for release build, do not cache build artifacts
|
||||
key: release # there are no elements about build result, so it's ok to share between all builds
|
||||
|
||||
- name: Setup
|
||||
run: ${{ matrix.setup }}
|
||||
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
with:
|
||||
tauriScript: cargo tauri
|
||||
args: --target ${{ matrix.triple }}
|
||||
|
||||
- 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}"
|
||||
mv "target/${{ matrix.triple }}/release/$src" "artifacts/$dst"
|
||||
done
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifacts-${{ matrix.triple }}
|
||||
path: artifacts/*
|
||||
|
||||
publish-to-github:
|
||||
name: Publish to GitHub
|
||||
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]
|
||||
env:
|
||||
GUI_VERSION: ${{ needs.pre-build.outputs.gui-version }}
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ secrets.APP_ID }}
|
||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||
- uses: actions/checkout@v3
|
||||
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: |-
|
||||
# Always prerelease for now.
|
||||
gh release create \
|
||||
--prerelease \
|
||||
${{ !needs.pre-build.outputs.prerelease && '--notes-file changelog/release-note.md' || '' }} \
|
||||
--verify-tag "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@v3
|
||||
with:
|
||||
ref: 'releasing'
|
||||
fetch-depth: 2
|
||||
- name: remove releasing branch
|
||||
run: git push --delete origin releasing
|
||||
|
|
@ -6,3 +6,6 @@ release_changer = ["cargo:vrc-get-vpm"]
|
|||
|
||||
[target.litedb]
|
||||
release_changer = ["cargo:vrc-get-litedb"]
|
||||
|
||||
[target.gui]
|
||||
release_changer = ["cargo:vrc-get-gui"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue