Merge pull request #218 from Schniz/fix-mutating-nullable-field #314
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 and Deploy | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build-examples: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
example: ["chat", "pets", "todo", "inspector"] | |
# example: ["twit", "chat", "counter-js-auth0", "pets", "twit", "file-drop", "inspector"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: gardencmp | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pnpm Build | |
run: | | |
pnpm install | |
pnpm turbo build; | |
working-directory: ./examples/${{ matrix.example }} | |
- name: Docker Build & Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./examples/${{ matrix.example }} | |
push: true | |
tags: ghcr.io/gardencmp/${{github.event.repository.name}}-example-${{ matrix.example }}:${{github.head_ref || github.ref_name}}-${{github.sha}}-${{github.run_number}}-${{github.run_attempt}} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-homepage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'pnpm' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: gardencmp | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pnpm Install (root) | |
run: | | |
pnpm install | |
working-directory: . | |
- name: Pnpm Install & Build (homepage) | |
run: | | |
pnpm install | |
pnpm build; | |
working-directory: ./homepage/homepage | |
- name: Docker Build & Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./homepage | |
push: true | |
tags: ghcr.io/gardencmp/${{github.event.repository.name}}-homepage-jazz:${{github.head_ref || github.ref_name}}-${{github.sha}}-${{github.run_number}}-${{github.run_attempt}} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy-examples: | |
runs-on: ubuntu-latest | |
needs: build-examples | |
strategy: | |
matrix: | |
example: ["chat", "pets", "todo", "inspector"] | |
# example: ["twit", "chat", "counter-js-auth0", "pets", "twit", "file-drop", "inspector"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: gacts/install-nomad@v1 | |
- name: Tailscale | |
uses: tailscale/github-action@v1 | |
with: | |
authkey: ${{ secrets.TAILSCALE_AUTHKEY }} | |
- name: Deploy on Nomad | |
run: | | |
if [ "${{github.ref_name}}" == "main" ]; then | |
export BRANCH_SUFFIX=""; | |
export BRANCH_SUBDOMAIN=""; | |
else | |
export BRANCH_SUFFIX=-${{github.head_ref || github.ref_name}}; | |
export BRANCH_SUBDOMAIN=${{github.head_ref || github.ref_name}}.; | |
fi | |
export DOCKER_USER=gardencmp; | |
export DOCKER_PASSWORD=${{ secrets.DOCKER_PULL_PAT }}; | |
export DOCKER_TAG=ghcr.io/gardencmp/${{github.event.repository.name}}-example-${{ matrix.example }}:${{github.head_ref || github.ref_name}}-${{github.sha}}-${{github.run_number}}-${{github.run_attempt}}; | |
envsubst '${DOCKER_USER} ${DOCKER_PASSWORD} ${DOCKER_TAG} ${BRANCH_SUFFIX} ${BRANCH_SUBDOMAIN}' < job-template.nomad > job-instance.nomad; | |
cat job-instance.nomad; | |
NOMAD_ADDR=${{ secrets.NOMAD_ADDR }} nomad job run job-instance.nomad; | |
working-directory: ./examples/${{ matrix.example }} | |
deploy-homepage: | |
runs-on: ubuntu-latest | |
needs: build-homepage | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: gacts/install-nomad@v1 | |
- name: Tailscale | |
uses: tailscale/github-action@v1 | |
with: | |
authkey: ${{ secrets.TAILSCALE_AUTHKEY }} | |
- name: Deploy on Nomad | |
run: | | |
if [ "${{github.ref_name}}" == "main" ]; then | |
export BRANCH_SUFFIX=""; | |
export BRANCH_SUBDOMAIN=""; | |
else | |
export BRANCH_SUFFIX=-${{github.head_ref || github.ref_name}}; | |
export BRANCH_SUBDOMAIN=${{github.head_ref || github.ref_name}}.; | |
fi | |
export DOCKER_USER=gardencmp; | |
export DOCKER_PASSWORD=${{ secrets.DOCKER_PULL_PAT }}; | |
export DOCKER_TAG=ghcr.io/gardencmp/${{github.event.repository.name}}-homepage-jazz:${{github.head_ref || github.ref_name}}-${{github.sha}}-${{github.run_number}}-${{github.run_attempt}}; | |
envsubst '${DOCKER_USER} ${DOCKER_PASSWORD} ${DOCKER_TAG} ${BRANCH_SUFFIX} ${BRANCH_SUBDOMAIN}' < job-template.nomad > job-instance.nomad; | |
cat job-instance.nomad; | |
NOMAD_ADDR=${{ secrets.NOMAD_ADDR }} nomad job run job-instance.nomad; | |
working-directory: ./homepage |