From 2f44cbd1006ab237c17046487fd023d6c7db641d Mon Sep 17 00:00:00 2001 From: RobotLeopard86 <63123751+RobotLeopard86@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:31:37 -0700 Subject: [PATCH] Add publish workflow --- .github/workflows/publish.yml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0df0ba6 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,48 @@ +name: Publish on release +permissions: write-all + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v3 + + - name: Install dependencies + run: npm i + + - name: Build project + run: npm run build + + - name: Upload production-ready build files + uses: actions/upload-artifact@v3 + with: + name: prod-files + path: ./dist + deploy: + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/main' + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: prod-files + path: ./dist + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist +