Skip to content

Commit

Permalink
Update node.js.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
timendum authored Aug 20, 2024
1 parent 724ae22 commit baa57e5
Showing 1 changed file with 49 additions and 31 deletions.
80 changes: 49 additions & 31 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit baa57e5

Please sign in to comment.