Some checks are pending
Build & Push Docker Image / docker (push) Waiting to run
49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
name: Build & Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: debian-runner
|
|
env:
|
|
REGISTRY_URL: ${{ secrets.REGISTRY_URL || 'git.4nkweb.com' }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node (for potential pre-steps)
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20.19'
|
|
cache: 'npm'
|
|
|
|
- name: Compute tags
|
|
id: meta
|
|
run: |
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
# sanitize branch to be a valid docker tag
|
|
SANITIZED=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9._-]+/-/g')
|
|
echo "branch=$SANITIZED" >> "$GITHUB_OUTPUT"
|
|
VERSION=$(jq -r .version package.json)
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY_URL }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build & Push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
provenance: false
|
|
tags: |
|
|
${{ env.REGISTRY_URL }}/4nk/4nk-ia-front:${{ steps.meta.outputs.branch }}
|
|
${{ env.REGISTRY_URL }}/4nk/4nk-ia-front:${{ steps.meta.outputs.version }}
|