-
Notifications
You must be signed in to change notification settings - Fork 26
76 lines (71 loc) · 2.37 KB
/
publish-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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 }}