Skip to content

feat: sfera playground #97

feat: sfera playground

feat: sfera playground #97

Workflow file for this run

name: Continuous Integration Webapp
defaults:
run:
working-directory: webapp
on:
push:
paths:
- 'webapp/**'
branches: [ "main" ]
pull_request:
paths:
- 'webapp/**'
branches: [ "main" ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
packages: write
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'webapp/.nvmrc'
cache: 'npm'
cache-dependency-path: 'webapp/package-lock.json'
- run: npm clean-install
- run: npm run lint
test:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'webapp/.nvmrc'
cache: 'npm'
cache-dependency-path: 'webapp/package-lock.json'
- run: npm clean-install
- run: npm test
build:
runs-on: ubuntu-latest
needs: lint
env:
IMAGE_REPO: ghcr.io/${{ github.repository }}/webapp
IMAGE_TAG: main
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'webapp/.nvmrc'
cache: 'npm'
cache-dependency-path: 'webapp/package-lock.json'
- run: npm clean-install
- run: npm run build
- name: Store build artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: webapp/dist/webapp/
- name: Login to GitHub Container Registry
if: github.ref == 'refs/heads/main'
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Create container image
if: github.ref == 'refs/heads/main'
run: |
# Convert to lowercase
IMAGE_REPO=$(echo $IMAGE_REPO | tr '[A-Z]' '[a-z]')
docker build -t $IMAGE_REPO:$IMAGE_TAG .
docker push $IMAGE_REPO:$IMAGE_TAG
env:
DOCKER_BUILDKIT: 1