57 lines
1.4 KiB
YAML
57 lines
1.4 KiB
YAML
name: build-image
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
build-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: npm
|
|
cache-dependency-path: backend/package-lock.json
|
|
|
|
- name: Install and test
|
|
working-directory: backend
|
|
run: |
|
|
npm ci
|
|
npm test
|
|
npm audit --omit=dev --audit-level=moderate
|
|
|
|
- name: Test legacy volume migration in Docker
|
|
run: |
|
|
docker build -t hotspot-volume-test:${{ github.sha }} ./backend
|
|
bash backend/test-container.sh hotspot-volume-test:${{ github.sha }}
|
|
|
|
- name: Login no Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.jf.eng.br
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build e push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: backend
|
|
push: true
|
|
tags: |
|
|
git.jf.eng.br/jfeng/hotspot:latest
|
|
git.jf.eng.br/jfeng/hotspot:${{ github.sha }}
|