75 lines
2.0 KiB
YAML
75 lines
2.0 KiB
YAML
name: Publish Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
lint-and-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
npm ci
|
|
cd frontend && npm ci
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Test (frontend build)
|
|
run: npm run test
|
|
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
needs: lint-and-test
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver-opts: |
|
|
image=moby/buildkit:v0.12.0
|
|
|
|
- name: Log in to Gitea Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.shts.su
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.ACTIONS_PAT }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.fast
|
|
push: true
|
|
platforms: linux/amd64
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
tags: |
|
|
git.shts.su/${{ gitea.repository }}:latest
|
|
git.shts.su/${{ gitea.repository }}:${{ gitea.sha }}
|
|
labels: |
|
|
org.opencontainers.image.title=RouterOS Manager
|
|
org.opencontainers.image.description=RouterOS Manager for domains and AS management
|
|
org.opencontainers.image.version=latest
|
|
org.opencontainers.image.revision=${{ gitea.sha }}
|
|
org.opencontainers.image.created=${{ gitea.event.head_commit.timestamp }}
|
|
build-args: |
|
|
BUILDKIT_INLINE_CACHE=1
|
|
|
|
- name: Trigger container update webhook
|
|
run: |
|
|
curl -X POST -sS --fail "${{ secrets.portainer_webhook }}" |