-
Notifications
You must be signed in to change notification settings - Fork 4
79 lines (65 loc) · 2.03 KB
/
release.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
name: Build and Release
on:
push:
branches:
- master
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-release:
name: Build and Release AngorHub
runs-on: ubuntu-latest
env:
PROJECT_NAME: "angor-hub"
steps:
# Step 1: Checkout repository
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: true
# Step 2: Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
# Step 3: Install dependencies
- name: Install Dependencies
run: npm ci
# Step 4: Determine version
- name: Set Version Variable
run: |
VERSION=$(npm run version --silent || echo "0.0.1")
echo "VERSION=$VERSION" >> $GITHUB_ENV
# Step 5: Set Release name
- name: Set Release Name
run: |
RELEASE_NAME=${{ env.PROJECT_NAME }}-${{ env.VERSION }}.zip
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
# Step 6: Build the project
- name: Build Project
run: npm run build
# Step 7: Verify build output
- name: Verify Build Output
run: ls -la dist
continue-on-error: false
# Step 8: Package build output
- name: Package Project
run: |
cd dist
zip -r ../${{ env.RELEASE_NAME }} .
continue-on-error: false
# Step 9: Upload Artifact
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.PROJECT_NAME }}-preview-${{ env.VERSION }}
path: ${{ env.RELEASE_NAME }}
# Step 10: Create/Update GitHub Release using GitHub CLI
- name: Create GitHub Release
run: |
gh release create ${{ env.VERSION }} ${{ env.RELEASE_NAME }} --title "${{ env.PROJECT_NAME }} v${{ env.VERSION }}" --draft --notes "Auto-generated release for version ${{ env.VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}