Skip to content

Publish Coordinator Image #3358

Publish Coordinator Image

Publish Coordinator Image #3358

name: Publish Coordinator Image
on:
workflow_dispatch:
inputs:
name:
description: "Manually running this workflow to build a coordinator image"
default: "Run"
new_tag:
description: "The new tag of the docker image"
required: false
type: string
default: latest-build
tracker_hash:
description: "[Internal usage] Used for tracking workflow job status within Meta infra"
required: false
type: str
env:
DISTRO: ubuntu
REGISTRY: ghcr.io
LOCAL_IMAGE_NAME: coordinator-local
REGISTRY_IMAGE_NAME: ghcr.io/${{ github.repository }}/coordinator
jobs:
push:
runs-on: ubuntu-latest
name: Build and publish image
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Print Tracker Hash
run: echo ${{ github.event.inputs.tracker_hash }}
- name: Build image
run: |
docker build --build-arg FBPCS_BUNDLE_ID=${{ github.event.inputs.new_tag }} -f ./fbpcs/Dockerfile -t ${{ env.LOCAL_IMAGE_NAME }}:${{ github.event.inputs.new_tag }} .
# Tests will be added here
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set output
id: vars
run: echo "ref=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
- name: Tag docker image
run: |
docker tag ${{ env.LOCAL_IMAGE_NAME }}:${{ github.event.inputs.new_tag }} ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.sha }}
docker tag ${{ env.LOCAL_IMAGE_NAME }}:${{ github.event.inputs.new_tag }} ${{ env.REGISTRY_IMAGE_NAME }}:${{ steps.vars.outputs.ref }}
docker tag ${{ env.LOCAL_IMAGE_NAME }}:${{ github.event.inputs.new_tag }} ${{ env.REGISTRY_IMAGE_NAME }}:${{ github.event.inputs.new_tag }}
- name: Push image to registry
run: |
docker push --all-tags ${{ env.REGISTRY_IMAGE_NAME }}