Last active
June 13, 2022 08:35
-
-
Save Luna-Klatzer/66d263fac4ebd09fd890f2ec4431a1dc to your computer and use it in GitHub Desktop.
Deploying a project using Parcel with the addition of a disclaimer banner
This file contains hidden or 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: Deploy GH-Pages | |
on: | |
push: | |
branches: [ main, master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
ROOT_BRANCH: # Your root branch - Either main or master | |
REDIRECT_URL: # YOUR PROJECT URL, usually: https://wmc-ahif-2021.github.io/{{ REPOSITORY_NAME }}/ | |
PACKAGE_JSON: https://gist.githubusercontent.com/Luna-Klatzer/1a099c115498fbdf01a6c4a749ceb2d5/raw/cd33260e9fdfc3d32110bae65d2d0058c97c1abe/package.json | |
PACKAGE_LOCK_JSON: https://gist.githubusercontent.com/Luna-Klatzer/c5d109f6f9f3e5002546cc1f758f1ee3/raw/3187d7bd182b88b54e61bc42c6f776a78ccfad89/package-lock.json | |
UPDATE_SCRIPT: https://gist.githubusercontent.com/Luna-Klatzer/a6f57a7ad7d79dc0a90115846cc98945/raw/756317baa73c904e3c2afef8cd10f3509dfc8dea/insert-html-banner.py | |
SCRIPT_FILE_NAME: insert-html-banner.py | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Run Setup for "tree" | |
run: sudo apt-get install tree | |
- name: Installs dependencies | |
run: | | |
curl ${{ env.PACKAGE_JSON }} > package.json | |
curl ${{ env.PACKAGE_LOCK_JSON }} > package-lock.json | |
npm ci | |
- name: Download Update Script | |
run: curl ${{ env.UPDATE_SCRIPT }} > ${{ env.SCRIPT_FILE_NAME }} | |
- name: Insert Disclaimer Header | |
run: python insert-html-banner.py | |
- name: Build Files using Parcel | |
run: parcel build src/index.html --public-url ${{ env.REDIRECT_URL }} --dist-dir . --no-content-hash --no-optimize --no-scope-hoist --no-source-maps | |
- name: Add Local Identification Config | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions" | |
- name: Commit changes to main | |
run: | | |
git add . | |
git commit -m "Updated parcel build" | |
git push origin +${{ env.ROOT_BRANCH }}:gh-pages --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment