|
| 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: '20' |
| 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 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 | + |
| 42 | + - name: Set up Node.js |
| 43 | + uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: '20' |
| 46 | + cache: 'npm' |
| 47 | + |
| 48 | + - name: Install Dependencies |
| 49 | + run: npm install |
| 50 | + |
| 51 | + - name: Generate Static Site |
| 52 | + run: npm run generate |
| 53 | + |
| 54 | + - name: Get Version from Tag |
| 55 | + id: get_version |
| 56 | + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
| 57 | + |
| 58 | + - name: Create Tarball Artifact |
| 59 | + run: | |
| 60 | + # The artifact will be named like 'stochastix-ui-v1.0.0.tar.gz' |
| 61 | + ARTIFACT_NAME="stochastix-ui-${{ env.VERSION }}.tar.gz" |
| 62 | + # Create the compressed tarball from the generated static output |
| 63 | + tar -czvf $ARTIFACT_NAME -C ./.output/public . |
| 64 | + # Make the artifact name available to other steps |
| 65 | + echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV |
| 66 | +
|
| 67 | + - name: Upload Build Artifact |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + name: ${{ env.ARTIFACT_NAME }} |
| 71 | + path: ${{ env.ARTIFACT_NAME }} |
0 commit comments