Files
shared-actions/.gitea/workflows/docker-release.yml
T
LucaZanni 218ca83525 ♻️ refactor(ci): rendi runner configurabile in docker-release
- Aggiunto input 'runner' con default 'catthehacker-latest'
- Permette ai consumer di specificare un runner diverso
- Aggiornato esempio microservizio con runner esplicito
2026-03-26 07:17:44 +01:00

84 lines
2.3 KiB
YAML

name: Docker Release
on:
workflow_call:
inputs:
node-version:
type: string
default: '22.17'
runner:
type: string
default: 'catthehacker-latest'
jobs:
docker-release:
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout
uses: https://gitea.com/actions/checkout@v4
- name: Setup Node.js
uses: https://gitea.com/actions/setup-node@v4
with:
node-version: ${{ inputs.node-version || '22.17' }}
- name: Cache npm
uses: https://gitea.com/actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Configure npm private registry
run: |
echo "@pzeta:registry=https://gitea.pzetatouch.it/api/packages/pzeta_touch/npm/" >> ~/.npmrc
echo "//gitea.pzetatouch.it/api/packages/pzeta_touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Lint
run: npm run lint:check
- name: Format check
run: npm run format:check
- name: Build
run: npm run build
- name: Test
run: npm run test
- name: Login to container registry
uses: https://gitea.com/docker/login-action@v3
with:
registry: gitea.pzetatouch.it
username: ${{ secrets.G_USER }}
password: ${{ secrets.NPM_TOKEN }}
- name: Determine image tags
id: tags
run: |
RAW_NAME=$(jq -r '.name' package.json)
APP_NAME=$(echo "$RAW_NAME" | sed 's|^@[^/]*/||')
VERSION=$(jq -r '.version' package.json)
REGISTRY="gitea.pzetatouch.it/pzeta_touch"
echo "version_tag=${REGISTRY}/${APP_NAME}:${VERSION}" >> $GITHUB_OUTPUT
echo "latest_tag=${REGISTRY}/${APP_NAME}:latest" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: https://gitea.com/docker/build-push-action@v6
with:
push: true
context: .
file: ./Dockerfile
tags: |
${{ steps.tags.outputs.version_tag }}
${{ steps.tags.outputs.latest_tag }}
build-args: |
NPM_TOKEN=${{ secrets.NPM_TOKEN }}