forked from OpenListTeam/OpenList-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (112 loc) · 3.71 KB
/
Copy pathbuild_rolling.yml
File metadata and controls
124 lines (112 loc) · 3.71 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# This workflow builds a rolling version of the OpenList frontend and publishes it on GitHub.
#
# This will:
#
# - Upload the release assets to GitHub (always git tagged `rolling`).
#
# This workflow can be triggered on pushes to the `main` branch, or manually via the GitHub Actions UI.
name: Rolling Build
on:
push:
branches:
- main
workflow_dispatch:
inputs:
draft:
description: "Create draft release"
required: false
default: true
type: boolean
jobs:
rolling:
name: Rolling Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
run_install: false
- name: Build Pre-release
run: |
chmod +x build.sh
./build.sh --dev --compress --skip-i18n
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Read version and determine tag name
id: version
run: |
version=$(cat dist/VERSION)
echo "version=$version" >> $GITHUB_OUTPUT
echo "tag_name=rolling" >> $GITHUB_OUTPUT
- name: Remove the existing pre-release
run: gh release delete ${{ steps.version.outputs.tag_name }} --cleanup-tag --yes || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish pre-release on GitHub
run: |
gh release create \
--title "Pre-release ${{ steps.version.outputs.version }}" \
--notes "Pre-release build for ${{ steps.version.outputs.version }}<br>This is a development build and not intended for production use." \
--prerelease \
--draft=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.draft || false }} \
${{ steps.version.outputs.tag_name }} \
dist/openlist-frontend-dist-v*-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout dist repo
uses: actions/checkout@v6
with:
ref: web-dist
path: web-dist
fetch-depth: 0
- name: Commit dist
run: |
cd web-dist
# git rm -rf .
# git update-ref -d HEAD
cp -r ../dist .
rm -f ./dist/*.tar.gz
touch .nojekyll
cat > edgeone.json <<EOF
{
"headers": [
{
"source": "/*",
"headers": [
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Access-Control-Allow-Methods",
"value": "GET, OPTIONS"
},
{
"key": "Access-Control-Allow-Headers",
"value": "Content-Type"
}
]
}
]
}
EOF
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "upload dev dist $(date '+%Y-%m-%d %H:%M:%S')"
git push --force
cd ..
permissions:
contents: write