Skip to content

feat(nx-cloud): setup nx workspace #2

feat(nx-cloud): setup nx workspace

feat(nx-cloud): setup nx workspace #2

Workflow file for this run

name: build
on:
push:
branches:
- main
pull_request:
permissions:
id-token: write
actions: read
contents: read
packages: write
env:
REGISTRY: ghcr.io
BACKEND_IMAGE: aofg/backend
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Connect your workspace on nx.app and uncomment this to enable task distribution.
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
# - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
# Cache node_modules
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- run: npm ci
- uses: nrwl/nx-set-shas@v4
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: npx nx-cloud record -- nx format:check
- run: INPUT_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} npx nx affected --base=$NX_BASE --head=$NX_HEAD -t lint build container
- name: Set environment variables
run: |
HELM_SHORT=`echo "${{ github.event.repository.name }}" | cut -c -52`
echo "HELM_SHORT=$HELM_SHORT" >> $GITHUB_ENV
- name: Install doctl and Authorize to Digital Ocean
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Login to registry
run: doctl registry login --expiry-seconds 3600
- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.DIGITALOCEAN_K8S_CLUSTER_ID }}
- name: Deploy
if: github.ref == 'refs/heads/main' || matrix.namespace != 'production'
run: |

Check failure on line 69 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / build

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 69, Col: 20): Unrecognized named-value: 'NX_BASE'. Located at position 1 within expression: NX_BASE
helm upgrade --install $HELM_SHORT ./.helm --namespace ${{ matrix.namespace }} --set image=${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:sha-${{ NX_BASE }} --set branch=$GIT_BRANCH --dry-run
helm upgrade --install $HELM_SHORT ./.helm --namespace ${{ matrix.namespace }} --set image=${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE }}:sha-${{ NX_BASE }} --set branch=$GIT_BRANCH --wait