Merge pull request #13 from MineralFish/dependabot/npm_and_yarn/svelt… #121
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-site | |
on: | |
push: | |
branches-ignore: | |
- build | |
workflow_dispatch: | |
env: | |
WORK_DIR: '' | |
jobs: | |
build-site: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: built-site | |
path: dist/ | |
- name: Checkout to build | |
uses: actions/checkout@v2 | |
with: | |
ref: 'build' | |
- name: Create and go to branch folder if needed | |
run: | | |
mkdir -p branches/${{ github.ref_name }} | |
echo "WORK_DIR=branches/${{ github.ref_name }}/" >> $GITHUB_ENV | |
if: github.ref_name != 'master' | |
- name: Clear out things | |
run: .| | |
rm -rf ./${{ env.WORK_DIR }}assets | |
rm -rf ./${{ env.WORK_DIR }}favicon.png | |
rm -rf ./${{ env.WORK_DIR }}global.css | |
rm -rf ./${{ env.WORK_DIR }}index.html | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: built-site | |
path: ./${{ env.WORK_DIR }} | |
- name: Commit and push | |
uses: EndBug/add-and-commit@v8 | |
with: | |
message: Build branch ${{ github.ref_name }} | |
push: true |