DIY Presence Detectors #157
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: Gatsby | |
on: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: gatsby | |
cancel-in-progress: true | |
jobs: | |
build-and-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🕘 Set runner timezone | |
uses: MathRobin/[email protected] | |
with: | |
timezoneLinux: "Australia/Sydney" | |
- name: 🛎️ Check out master branch | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: 💭 Get nvm version | |
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT | |
id: nvm | |
- name: ⚙️ Setup node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ steps.nvm.outputs.NODE_VERSION }} | |
- name: 🧶 Get Yarn cache directory | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: 🧶 Get Yarn cache | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: 🧶 Yarn install | |
run: yarn install --immutable | |
- name: 💨 ESLint | |
run: yarn lint:js | |
- name: ☄️ markdownlint | |
run: yarn lint:md | |
- name: 🥡 Getting Gatsby cache | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: | | |
public | |
.cache | |
key: ${{ runner.os }}-gatsby-build- | |
restore-keys: | | |
${{ runner.os }}-gatsby-build- | |
- name: 🧶 Yarn build | |
run: yarn build | |
- name: ⤴️ Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: public | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
pages: write | |
id-token: write | |
needs: build-and-lint | |
steps: | |
- name: 🚀 Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |