Skip to content

Merge branch 'main' into 3577-app #16

Merge branch 'main' into 3577-app

Merge branch 'main' into 3577-app #16

name: (WIP) Build and deploy app on CI
on:
push:
paths:
- "app/**"
- "packages/**"
- ".github/**" # TODO: remove
branches: # TODO: remove me
- 3577-app
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.20"
- uses: actions/cache@v4
id: cache-npm
with:
path: |
node_modules
app/node_modules
packages/ds/node_modules
packages/lib/node_modules
key: ${{ runner.os }}-nodemodules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-nodemodules-
- name: Install packages
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm install --only=dev
# Typescript check
- name: Check types
env:
APP_NAME: app
continue-on-error: false
run: npm run check-types
# ESLint check
- name: Lint code
env:
APP_NAME: app
continue-on-error: false
run: npm run lint
deploy:
needs: [test]
runs-on: ubuntu-latest
outputs:
release: ${{ steps.release.outputs.release }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.20"
- name: Get release name
id: release
working-directory: devops/scripts
run: |
release=$(node get-image-tag.js ${{ github.event.after }})
echo "release: $release"
echo "release=$release" >> $GITHUB_OUTPUT
- name: Docker Build & Publish
working-directory: devops/scripts
env:
SCW_SECRET_KEY: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
SCW_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID }}
VITE_RELEASE: ${{ steps.release.outputs.release }}
run: |
node ./build-front-app-docker.js ci app --push
- name: Deploy on Scaleway
working-directory: devops/scripts
env:
SCW_SECRET_KEY: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
SCW_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID }}
run: |
node ./deploy-scaleway.js ci app ${{ steps.release.outputs.release }}