chor(ci): tag images with app-version #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build & publish | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["ci"] | |
# Registry owner part must be lowercase for some tools to work | |
env: | |
REGISTRY: ghcr.io/notalib | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
# NOTE: Requires repo to have Write access under Package > Manage Actions access | |
packages: write | |
steps: | |
# Setup | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # fetch history & tags, needed by gitversion | |
fetch-tags: true | |
- uses: docker/setup-buildx-action@v3.0.0 | |
- name: Login to registry ghcr.io | |
uses: docker/login-action@v3.0.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: nota-ci | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get version | |
id: version | |
run: | | |
APP_VERSION=$(grep "Software_Version = "$1"" $GIT_ROOT/api/common_server.go | awk '{print $3}' | sed 's/"//g') | |
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV | |
# Build lcpserver | |
- name: Extract image metadata | |
id: meta_lcp | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: ghcr.io/${{ github.repository }}/lcpserver | |
tags: | | |
latest | |
type=sha | |
type=ref,event=branch | |
${{ steps.version.outputs.APP_VERSION }} | |
- name: Build LCP Server | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: "." | |
file: "./ci/Dockerfile" | |
target: runtime-lcp | |
push: ${{ github.event_name != 'pull_request' }} # Don't push on PR | |
tags: ${{ steps.meta_lcp.outputs.tags }} | |
labels: ${{ steps.meta_lcp.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
# Build lsdserver | |
- name: Extract image metadata | |
id: meta_lsd | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: ghcr.io/${{ github.repository }}/lsdserver | |
tags: | | |
latest | |
type=sha | |
type=ref,event=branch | |
${{ steps.version.outputs.APP_VERSION }} | |
- name: Build LSD Server | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: "." | |
file: "./ci/Dockerfile" | |
target: runtime-lsd | |
push: ${{ github.event_name != 'pull_request' }} # Don't push on PR | |
tags: ${{ steps.meta_lsd.outputs.tags }} | |
labels: ${{ steps.meta_lsd.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 |