DM-40673: Docker build of nginx container with Gatsby static site #743
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: CI | |
on: | |
push: | |
branches: | |
- master | |
- main | |
pull_request: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Read .nvmrc | |
id: node_version | |
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) | |
- name: Set up node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ steps.node_version.outputs.NODE_VERSION }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install npm packages | |
run: npm install . | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Read .nvmrc | |
id: node_version | |
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) | |
- name: Set up node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ steps.node_version.outputs.NODE_VERSION }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install npm packages | |
run: npm install . | |
- name: Build Gatsby site | |
run: npm run build | |
- name: List build directory | |
run: ls -l public | |
- uses: lsst-sqre/build-and-push-to-ghcr@v1 | |
id: build | |
with: | |
image: ${{ github.repository }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- run: echo Pushed ghcr.io/${{ github.repository }}:${{ steps.build.outputs.tag }} |