Skip to content

Commit

Permalink
fix: test github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
JadlionHD committed Sep 5, 2024
1 parent 8e9be08 commit 88f21c9
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 36 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build React

on:
push:
branches: ["**"]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Build website
run: pnpm run build

- name: Compress build files
run: zip -r build.zip dist

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build.zip
path: build.zip
53 changes: 17 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,30 @@
name: Build React
name: Release

on:
push:
branches: ["main"]
release:
types: [published]

jobs:
build:
uses: ./.github/workflows/build.yml
release:
needs: build
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Build website
run: pnpm run build

- name: Compress build files
run: zip -r build.zip dist
name: build.zip

- name: Upload ZIP to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Artifacts to GitHub Release
uses: ncipollo/release-action@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build.zip
asset_name: build.zip
asset_content_type: application/zip
artifacts: build.zip
allowUpdates: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true

0 comments on commit 88f21c9

Please sign in to comment.