-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d7136a
commit 737511d
Showing
1 changed file
with
51 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,62 @@ | ||
name: Deploy site to Pages | ||
|
||
name: Build and release | ||
on: | ||
push: | ||
branches: [master] | ||
|
||
branches: [feature-testci] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
release: | ||
permissions: | ||
contents: write | ||
actions: write | ||
attestations: write | ||
deployments: write | ||
packages: write | ||
id-token: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [macos-latest, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Not needed if lastUpdated is not enabled | ||
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
# 检出存储库 | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# 设置 rust 环境 | ||
- name: Rust setup | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
# rust 缓存 | ||
- name: Rust cache | ||
uses: swatinem/rust-cache@v2 | ||
with: | ||
node-version: 18 | ||
cache: yarn # or pnpm / yarn | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Install dependencies | ||
run: yarn install # or pnpm install / yarn install | ||
- name: Build | ||
run: yarn build # or pnpm docs:build / yarn docs:build | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
workspaces: './src-tauri -> target' | ||
|
||
# 设置 node 环境 | ||
- name: Sync node version and setup cache | ||
uses: actions/setup-node@v4 | ||
with: | ||
path: dist | ||
node-version: 'lts/*' | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: github-pages | ||
path: artifact | ||
- name: Extract artifact | ||
run: tar -xf artifact/*.tar --directory artifact | ||
# 全局安装pnpm | ||
- name: Install pnpm | ||
run: npm install -g pnpm | ||
|
||
# 安装前端依赖 | ||
- name: Install frontend dependencies | ||
run: pnpm install | ||
|
||
# 构建应用 | ||
- name: Build the app | ||
uses: tauri-apps/tauri-action@v0 | ||
|
||
- name: Deploy to Server | ||
uses: easingthemes/[email protected] | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
ARGS: '-rltgoDzvO --delete' | ||
SOURCE: artifact/* | ||
REMOTE_HOST: ${{ secrets.SERVER_HOST }} | ||
REMOTE_USER: ${{ secrets.SERVER_USERNAME }} | ||
TARGET: /usr/share/nginx/XTools/ | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tagName: ${{ github.ref_name }} | ||
releaseName: 'XTools v__VERSION__' | ||
releaseBody: 'See the assets to download and install this version.' | ||
releaseDraft: true | ||
prerelease: false |