Skip to content

v1.7.5

v1.7.5 #400

Workflow file for this run

name: build
on:
workflow_dispatch:
release:
types: [ published ]
env:
REPO: cashtrack/api
jobs:
build:
runs-on: [self-hosted, Linux, x64]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
if: github.event_name != 'pull_request'
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REPO }}
tags: |
type=sha
type=semver,pattern={{version}}
# Setup BuildX
# https://github.com/docker/setup-buildx-action
- name: Setup BuildX
uses: docker/setup-buildx-action@v3
id: buildx
with:
install: true
# Build and push Docker image with Build (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_COMMIT=${{ github.sha }}
GIT_TAG=${{ github.ref_name }}