Skip to content

Add lint, build, deploy jobs to github action #4

Add lint, build, deploy jobs to github action

Add lint, build, deploy jobs to github action #4

Workflow file for this run

name: Continuous Integration and Continuous Delivery
on:
push:
permissions:
id-token: write
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout to the branch
uses: actions/checkout@v4
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
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('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
- name: Install dependencies
run: npm install --prefer-offline
# - name: Typecheck
# run: npm run typecheck
- name: Lint ESLint
run: npm run lint
- name: Lint Prettier
run: npm run prettier
build:
runs-on: ubuntu-latest
need: [lint]

Check failure on line 50 in .github/workflows/cicd.yml

View workflow run for this annotation

GitHub Actions / Continuous Integration and Continuous Delivery

Invalid workflow file

The workflow is not valid. .github/workflows/cicd.yml (Line: 50, Col: 5): Unexpected value 'need'
steps:
- name: Checkout to the branch
uses: actions/checkout@v4
- name: Docker Login
uses: docker/login-action@v3
with:
registry: ${{ secrets.ACR_URL }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build and Push to ACR
uses: docker/build-push-action@v2
with:
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ secrets.ACR_URL }}/krokelo:${{ github.sha }}
file: Dockerfile
build-args: |
DATABASE_URL=${{ secrets.DATABASE_URL }}
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Redeploy Azure Container App
run: |
az containerapp revision copy \
--name krokelo \
--resource-group sbu-public-krokelo-nww-nea-rg \
--cpu 1 \
--memory 2.0 \
--image ${{ secrets.ACR_URL }}/krokelo:${{ github.sha }}