Skip to content

Commit b22d9fe

Browse files
committed
ci: add github workflow
1 parent 390e93d commit b22d9fe

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Stochastix UI CI/CD
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags:
7+
- 'v*.*.*'
8+
pull_request:
9+
branches: [ master ]
10+
11+
jobs:
12+
test_and_build:
13+
name: Test & Build
14+
if: "!startsWith(github.ref, 'refs/tags/')"
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '24'
25+
cache: 'npm'
26+
27+
- name: Install Dependencies
28+
run: npm install
29+
30+
- name: Generate Static Site (Build & Type Check)
31+
run: npm run generate
32+
33+
release:
34+
name: Create Release and Upload Artifact
35+
if: "startsWith(github.ref, 'refs/tags/')"
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout Code
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Set up Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: '24'
48+
cache: 'npm'
49+
50+
- name: Install Dependencies
51+
run: npm install
52+
53+
- name: Generate Static Site
54+
run: npm run generate
55+
56+
- name: Get Version from Tag
57+
id: get_version
58+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
59+
60+
- name: Create Tarball Artifact
61+
run: |
62+
ARTIFACT_NAME="stochastix-ui-${{ env.VERSION }}.tar.gz"
63+
tar -czvf $ARTIFACT_NAME -C ./.output/public .
64+
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
65+
66+
- name: Generate Changelog
67+
id: changelog
68+
uses: mikepenz/release-changelog-builder-action@v4
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: Create GitHub Release
73+
id: create_release
74+
uses: actions/create-release@v1
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
tag_name: ${{ github.ref }}
79+
release_name: Release ${{ env.VERSION }}
80+
body: ${{ steps.changelog.outputs.changelog }}
81+
82+
- name: Upload Release Asset
83+
uses: actions/upload-release-asset@v1
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
with:
87+
upload_url: ${{ steps.create_release.outputs.upload_url }}
88+
asset_path: ./${{ env.ARTIFACT_NAME }}
89+
asset_name: ${{ env.ARTIFACT_NAME }}
90+
asset_content_type: application/gzip

0 commit comments

Comments
 (0)