diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index e718e2e..a616d74 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,41 +1,59 @@ -name: Node.js CI +name: Deploy static content to Pages and Create release on tag on: push: - branches: [ "main" ] - tags: - - '*' + branches: ["main"] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} build: permissions: contents: write runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - name: Build - run: | - npm install - npm run-script build - tar -cvzf release.tar.gz --exclude='*.map' -C build . - tar -cvzf release-with-maps.tar.gz -C build . - - name: GH Release - uses: technote-space/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - release.tar.gz - release-with-maps.tar.gz - - name: Publish - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./build + - uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "npm" + - name: Install dependencies + run: npm ci + - name: Build + run: | + npm run build + tar -cvzf release.tar.gz --exclude='*.map' -C build . + tar -cvzf release-with-maps.tar.gz -C build . + - name: GH Release + uses: technote-space/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + release.tar.gz + release-with-maps.tar.gz + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload dist folder + path: "./build" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4