From 88f21c9c32a0ac382a897de060ec66ed3f9fc379 Mon Sep 17 00:00:00 2001 From: Hendra Gunawan <48410066+JadlionHD@users.noreply.github.com> Date: Fri, 6 Sep 2024 01:43:21 +0700 Subject: [PATCH] fix: test github actions --- .github/workflows/build.yml | 43 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 53 +++++++++++------------------------ 2 files changed, 60 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6add334 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c1d834..d2f7baa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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