publish_images #1850
Workflow file for this run
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: publish_images | |
on: | |
push: | |
branches: | |
- main | |
create: | |
# Publish semver tags as releases. | |
tags: [ 'v*.*.*' ] | |
permissions: | |
contents: read | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
HUB_AGENT_IMAGE_NAME : hub-agent | |
HUB_AGENT_IMAGE_VERSION: main | |
MEMBER_AGENT_IMAGE_NAME: member-agent | |
MEMBER_AGENT_IMAGE_VERSION: main | |
REFRESH_TOKEN_IMAGE_NAME: refresh-token | |
REFRESH_TOKEN_IMAGE_VERSION: main | |
jobs: | |
export-registry: | |
runs-on: ubuntu-20.04 | |
outputs: | |
registry: ${{ steps.export.outputs.registry }} | |
steps: | |
- id: export | |
run: | | |
# registry must be in lowercase | |
echo "registry=$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr [:upper:] [:lower:])" >> $GITHUB_OUTPUT | |
publish-images: | |
needs: export-registry | |
env: | |
REGISTRY: ${{ needs.export-registry.outputs.registry }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Set image version for a new release | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
echo "HUB_AGENT_IMAGE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
echo "MEMBER_AGENT_IMAGE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
echo "REFRESH_TOKEN_IMAGE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Login to ${{ env.REGISTRY }} | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build ${{ env.HUB_AGENT_IMAGE_NAME}} | |
run: | | |
make docker-build-hub-agent | |
env: | |
REGISTRY: ${{ env.REGISTRY}} | |
IMAGE_NAME: ${{ env.HUB_AGENT_IMAGE_NAME}} | |
IMAGE_VERSION: ${{ env.HUB_AGENT_IMAGE_VERSION }} | |
- name: Build ${{ env.MEMBER_AGENT_IMAGE_NAME}} | |
run: | | |
make docker-build-member-agent | |
env: | |
REGISTRY: ${{ env.REGISTRY}} | |
IMAGE_NAME: ${{ env.MEMBER_AGENT_IMAGE_NAME}} | |
IMAGE_VERSION: ${{ env.MEMBER_AGENT_MIMAGE_VERSION }} | |
- name: Build ${{ env.REFRESH_TOKEN_IMAGE_NAME}} | |
run: | | |
make docker-build-refresh-token | |
env: | |
IMAGE_NAME: ${{ env.REFRESH_TOKEN_IMAGE_NAME}} | |
IMAGE_VERSION: ${{ env.REFRESH_TOKEN_MIMAGE_VERSION }} |