chore: package updates #213
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
# This is a basic workflow to help you get started with Actions | |
name: Roxberry.DEV CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [main] | |
# schedule: | |
# # * is a special character in YAML so you have to quote this string | |
# - cron: "0 8 * * *" | |
jobs: | |
buildAndPublish: | |
runs-on: [ubuntu-latest] | |
steps: | |
- name: checkout gh-pages branch # checkout gh-pages branch | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: remove all files # remove files. | |
run: | | |
rm -rf * | |
- name: create CNAME file # remove files. | |
run: | | |
echo "roxberry.dev" > CNAME | |
- name: checkout main branch #checkout main branch into temp folder. | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
path: temp | |
persist-credentials: false | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Gatsby Cache Folder | |
uses: actions/cache@v1 | |
id: gatsby-cache-folder | |
with: | |
path: .cache | |
key: ${{ runner.os }}-cache-gatsby | |
restore-keys: | | |
${{ runner.os }}-cache-gatsby | |
- name: Gatsby Public Folder | |
uses: actions/cache@v1 | |
id: gatsby-public-folder | |
with: | |
path: public/ | |
key: ${{ runner.os }}-public-gatsby | |
restore-keys: | | |
${{ runner.os }}-public-gatsby | |
- name: run npm install and build # go to temp folder and run npm build to create files. | |
run: | | |
cd temp | |
npm install | |
npm run build:incremental | |
- name: move files # move the dist files into root dir and remove others. | |
if: ${{ success() }} | |
run: | | |
mv temp/public/* ./ | |
rm -rf temp | |
- name: Commit files for change # commit | |
if: ${{ success() }} | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Add changes" | |
- name: Push changes #push files into gh-pages branch | |
if: ${{ success() }} | |
uses: ad-m/github-push-action@master | |
with: | |
BRANCH: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force: true | |