Skip to content

Get FLEx model version from repo and store in metadata #230

Get FLEx model version from repo and store in metadata

Get FLEx model version from repo and store in metadata #230

Workflow file for this run

name: hgweb
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on:
push:
paths:
- 'hgweb/**'
- '.github/workflows/lexbox-hgweb.yaml'
branches:
- develop
pull_request:
paths:
- 'hgweb/**'
- '.github/workflows/lexbox-hgweb.yaml'
branches:
- develop
workflow_call:
inputs:
version:
description: 'The version of the image to build'
required: true
type: string
label-latest:
description: 'The label to apply to the latest image'
type: boolean
default: false
env:
PROD_RELEASE: ${{ inputs.label-latest || false}}
IMAGE_NAME: ghcr.io/sillsdev/lexbox-hgweb
VERSION: ${{ inputs.version }}
jobs:
publish-hgweb:
runs-on: ubuntu-latest
outputs:
version: ${{ inputs.version || steps.setVersion.outputs.VERSION }}
env:
# https://docs.docker.com/develop/develop-images/build_enhancements/
DOCKER_BUILDKIT: 1
steps:
-
uses: actions/checkout@v4
- name: Set Version
id: setVersion
if: ${{ !env.VERSION }}
# set version to date in vYYYY-MM-DD-commitSha format
run: |
shortSha=$(echo ${{ github.sha }} | cut -c1-8)
echo "VERSION=v$(date --rfc-3339=date)-$shortSha" >> ${GITHUB_OUTPUT}
echo "VERSION=v$(date --rfc-3339=date)-$shortSha" >> ${GITHUB_ENV}
- name: Docker meta
id: meta
if: ${{ !env.ACT }}
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,enable=${{ env.PROD_RELEASE }},value=latest
type=raw,value=${{ env.VERSION }}
-
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: hgweb
build-args: |
APP_VERSION=${{ env.VERSION }}
push: ${{ !env.ACT }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy-hgweb:
uses: ./.github/workflows/deploy.yaml
if: ${{github.ref == 'refs/heads/develop' && github.event_name == 'push'}}
secrets: inherit
needs: publish-hgweb
with:
version: ${{ needs.publish-hgweb.outputs.version }}
image: 'ghcr.io/sillsdev/lexbox-hgweb'
deploy-domain: lexbox.dev.languagetechnology.org
k8s-environment: 'develop'