Merge pull request #697 from kids-first/release-1.35.0-🏷 #12
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 and Publish Image | |
on: | |
push: | |
branches: | |
- "master" | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
jobs: | |
build-publish-prd-image: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'release' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Build and Publish" | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/kids-first/kf-api-dataservice/kf-api-dataservice:${{ github.ref_name }} | |
build-publish-dev-image: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- name: Force fetch tag info | |
run: | | |
git fetch --prune --unshallow --tags | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set git tag and SHA | |
run: | | |
VERSION=$(git tag --sort=committerdate | grep -E '[0-9]' | tail -1 | cut -b 1-7) | |
SHORT_SHA=${GITHUB_SHA:0:7} | |
TAG="${VERSION}-${SHORT_SHA}" | |
echo "TAG=${TAG}" >> $GITHUB_ENV | |
- name: "Build and Publish" | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/kids-first/kf-api-dataservice/kf-api-dataservice:dev-release-${{ env.TAG }} |