forked from FederatedAI/FedLCM
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.25 KB
/
site-portal-docker-build-and-push.yaml
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
name: Site-Portal docker build and push
on:
push:
# Publish `main` as Docker `latest` image.
branches:
- main
# Publish `v1.2.3` tags as releases.
tags:
- v*
jobs:
# no test is required
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@main
- name: Prepare the TAG
id: prepare-the-tag
run: |
# strip git ref prefix from version
TAG=""
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
if [ $VERSION = "main" ]; then
TAG="latest"
fi
echo "TAG=${TAG}"
echo "TAG=${TAG}" >> $GITHUB_OUTPUT
- name: Build image
run: |
TAG=${{steps.prepare-the-tag.outputs.TAG}}
if [ ! -z "$TAG" ]; then
export TAG=$TAG
fi
cd site-portal
make docker-build
- name: Log into DockerHub
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image
run: |
TAG=${{steps.prepare-the-tag.outputs.TAG}}
if [ ! -z "$TAG" ]; then
export TAG=$TAG
fi
cd site-portal
make docker-push