forked from MetaCubeX/Yacd-meta
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (99 loc) · 2.61 KB
/
push.yml
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
name: Build and Release Frontend
on:
push:
branches:
- master
release:
types:
- created
- published
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout Dashboard code
uses: actions/checkout@v3
# Set up pnpm
- uses: pnpm/action-setup@v2
with:
version: latest
# Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: pnpm
# Install packages and build the project
- name: Install package and build
run: |
pnpm install --no-frozen-lockfile
pnpm build
# Zip the build output
- name: Zip build output
id: zip_output
run: |
zip -r yacd.zip ./public
# Upload the artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: yacd
path: yacd.zip
Upload-Prerelease:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push'
steps:
# Download build artifact from build job
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: yacd
path: ./build/
- name: Delete current release assets
uses: 8Mi-Tech/delete-release-assets-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: Prerelease
deleteOnlyFromDrafts: false
- name: Set Env
run: |
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
shell: bash
- name: Tag Repo
uses: richardsimko/update-tag@v1
with:
tag_name: Prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Prerelease
uses: softprops/action-gh-release@v1
with:
tag_name: Prerelease
files: |
./build/*.zip
prerelease: true
Upload-Release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'workflow_dispatch'
steps:
# Download build artifact from build job
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: yacd
path: ./build/
- name: Upload Release
uses: softprops/action-gh-release@v2
if: ${{ success() }}
with:
tag_name: ${{ github.event.inputs.version }}
files: |
./build/*.zip