From c6ededd653c8c7729c8175bf0690d46953569df8 Mon Sep 17 00:00:00 2001 From: yhsphd Date: Tue, 4 Jun 2024 14:03:30 +0900 Subject: [PATCH] CI: add process of downloading integrated frontend --- .github/workflows/build.yml | 33 ------------------ .github/workflows/ci.yml | 69 +++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 9df2015..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Build and Upload Artifacts -on: - push: - branches: ["kdc2024"] - pull_request: - branches: ["kdc2024"] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - name: Use Node.js 18.x (This is the last major version that pkg supports) - uses: actions/setup-node@v4 - with: - node-version: 18.x - cache: "npm" - - - name: Download dependencies - run: npm ci - - - name: Build - run: npm run build --if-present - # run: npm test - - - name: Upload Build Artifact - uses: actions/upload-artifact@v4 - with: - name: kdc-overlay - path: dist/kdc-overlay.exe diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c91b16a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: Continuous Integration +on: ["push", "pull_request"] + +permissions: + contents: write + pull-requests: read + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + ##################### + # Setup Environment # + ##################### + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js 18.x (This is the last major version that pkg supports) + uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: "npm" + + ###################### + # Check Version Bump # + ###################### + + - name: Check if version has been updated + id: check + uses: EndBug/version-check@v2 + + - name: Log when changed + if: steps.check.outputs.changed == 'true' + run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"' + + - name: Log when unchanged + if: steps.check.outputs.changed == 'false' + run: 'echo "No version change :/"' + + ######### + # Build # + ######### + + - name: Download dependencies + run: npm ci + + - name: Download latest release of kdc-overlay-front + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: "Duo-Cup-Korea/kdc-overlay-front" + file: "kdc-overlay-front.zip" + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install frontend to the public folder + run: | + mkdir public + unzip kdc-overlay-front.zip -d public + + - name: Build + run: npm run build --if-present + # run: npm test + + - name: Upload Build Artifact + uses: actions/upload-artifact@v4 + with: + name: kdc-overlay + path: dist/kdc-overlay.exe