Build Code #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
run-name: Build Code | |
on: | |
push: | |
branches: ['main', 'staging'] | |
permissions: | |
contents: write | |
concurrency: | |
group: "build-deploy" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Build App | |
run: | | |
npm ci | |
npm run build | |
cd dist | |
touch .nojekyll | |
- name: Minify Code | |
uses: Lenni009/minify-js@main | |
with: | |
directory: dist | |
overwrite: true | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: HubWikiPageCreator | |
path: dist | |
deploy-prod: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: HubWikiPageCreator | |
path: dist | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: dist # The folder the action should deploy. | |
deploy-staging: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/staging' | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: HubWikiPageCreator | |
path: dist | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: dist # The folder the action should deploy. | |
target-folder: staging # The folder the action should deploy to. |