- introduce lint job in build.yml for code quality checks - ensure lint job runs before docker job - setup Node.js and install dependencies for ESLint
43 lines
984 B
YAML
43 lines
984 B
YAML
name: build-and-push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Run ESLint
|
|
run: npm run lint
|
|
|
|
docker:
|
|
needs: lint
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to registry
|
|
run: echo "${{ secrets.REG_TOKEN }}" | docker login "${{ secrets.REGISTRY }}" -u "${{ secrets.REG_USER }}" --password-stdin
|
|
|
|
- name: Build image
|
|
run: |
|
|
docker buildx build --load \
|
|
-t "${{ secrets.REGISTRY_IMAGE }}:latest" .
|
|
|
|
- name: Push image
|
|
run: |
|
|
docker push "${{ secrets.REGISTRY_IMAGE }}:latest"
|