Repository navigation
96 lines (92 loc) · 3.16 KB
/
Copy pathupload.yaml
File metadata and controls
96 lines (92 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Check and upload
on:
push:
branches: [main, master]
pull_request: {}
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@v6.5.0
with:
node-version: 24
package-manager-cache: false
- uses: calcit-lang/setup-calcit@v1.5.0
with:
tools: calcit,caps
caps-version: "0.1.1"
deps-file: deps.cirru
- name: Install dependencies
run: |
set -euo pipefail
corepack enable
corepack prepare yarn@4.18.0 --activate
caps --strict --ci
yarn install --immutable
caps verify --toolchain
git diff --quiet -- deps.cirru package.json yarn.lock .yarnrc.yml
- name: Check and test Calcit
run: |
set -euo pipefail
calcit edit format
git diff --quiet -- calcit.cirru
calcit --check-only --all-defs --format json
calcit fix --workflow strict --verify --format json | jq -e '.data.workflow.status == "passed" and .diagnostics == []'
calcit analyze weak-types --ns-prefix app --only deprecated-call --summary-only --format json | jq -e '.data.summary.calls == 0'
calcit analyze weak-types --only dynamic-method --summary-only --format json | jq -e '.data.summary.findings == 0'
calcit test --require-match --summary-only --format json
- name: Build frontend
run: |
set -euo pipefail
calcit js
base_url="https://cos-sh.tiye.me/${GITHUB_REPOSITORY}/"
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
base_url="./"
fi
yarn vite build --base="$base_url"
- uses: actions/upload-artifact@v7.0.2
with:
name: client-dist
path: dist/
if-no-files-found: error
retention-days: 7
upload:
needs: test
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
runs-on: ubuntu-24.04
timeout-minutes: 15
concurrency:
group: cos-${{ github.repository }}
cancel-in-progress: false
queue: max
steps:
- uses: actions/download-artifact@v8.0.2
with:
name: client-dist
path: dist/
- name: Upload and verify frontend resources
uses: worktools/cos-upload-action@v1.2.0
with:
source-dir: dist
bucket: ${{ secrets.COS_BUCKET }}
region: ap-shanghai
prefix: ${{ github.repository }}/
public-base-url: https://cos-sh.tiye.me/${{ github.repository }}/
secret-id: ${{ secrets.COS_SECRET_ID }}
secret-key: ${{ secrets.COS_SECRET_KEY }}
- name: Deploy to original server path
uses: Pendect/action-rsyncer@v2.0.0
env:
DEPLOY_KEY: ${{ secrets.rsync_private_key }}
with:
flags: '-avzr --progress'
options: ''
ssh_options: ''
src: 'dist/*'
dest: 'rsync-user@tiye.me:/web-assets/repo/${{ github.repository }}'