-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (37 loc) · 1.58 KB
/
publish-ghrch.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
name: Docker Image CI for GHRC
on: [push]
jobs:
staging:
runs-on: ubuntu-latest
env:
ACTIONS_RUNNER_DEBUG: true
ACTIONS_STEP_DEBUG: true
environment:
name: build
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.GH_SUBMODULE_TOKEN }}
- name: Login to Docker registry
run: |
echo "Logging into Docker registry..."
echo "${{ secrets.GHRC_PASSWORD }}" | docker login ghcr.io -u ${{ secrets.GHRC_USERNAME }} --password-stdin
echo "Logging into Docker registry success"
- name: Determine image tag and build Docker image
id: build
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
DOCKER_TAG="latest"
elif [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
DOCKER_TAG="dev"
elif [[ "${{ github.ref }}" =~ ^refs/heads/rc/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
DOCKER_TAG="${{ github.ref }}_RC"
else
exit 1
fi
echo "Building Docker image with tag $TAG..."
docker build --no-cache -t ${{ secrets.GHRC_REGISTRY_ADDR }}:$DOCKER_TAG .
docker push ${{ secrets.GHRC_REGISTRY_ADDR }}:$DOCKER_TAG
echo "Build and push Docker image ok ..."