-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (76 loc) · 2.81 KB
/
docker.yaml
File metadata and controls
89 lines (76 loc) · 2.81 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
# CI workflow for Docker feature
#
# Description:
# This CI workflow for releasing Docker image to Docker hub.
#
# Processes:
# 1. Generate the tag by software version for Docker image
# 2. Build the Docker image and name it with the tag
# 3. Push the Docker image to Docker hub
#
# Trigger condition:
# This CI workflow only be triggered by changing the package info module (__pkg_info__.py) of *PyFake-API-Server*.
#
name: docker
on:
push:
branches:
- "master"
paths:
- "**/__pkg_info__.py"
# Only activate below setting for developing, testing or troubleshooting
# - ".github/workflows/docker.yaml"
env:
DOCKER_ACCOUNT: chisanan232
DOCKER_IMAGE_NAME: pyfake-api-server
# DOCKER_IMAGE_NAME: test # For testing
RELEASE_TYPE: python-package
PYTHON_PACKAGE_NAME: fake_api_server
SOFTWARE_VERSION_FORMAT: general-3
# RUNNING_MODE: dry-run
permissions:
contents: write
jobs:
check_version-state:
# name: Check the version update state
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_checking_deployment_state.yaml@v7.3
with:
library-name: fake-api-server
library-source-code-path: ./fake_api_server
check_version_info:
# name: Check the package version info to make sure whether it should release Docker image or not.
needs: check_version-state
if: ${{ needs.check_version-state.outputs.version_update_state == 'VERSION UPDATE' }}
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_build_git-tag_and_create_github-release.yaml@v7.3
secrets:
github_auth_token: ${{ secrets.GITHUB_TOKEN }}
with:
project_type: python-package
project_name: fake_api_server
software_version_format: general-3
debug_mode: true
deploy_docker:
needs: check_version_info
if: ${{ needs.check_version_info.outputs.python_release_version == 'Official-Release' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build Docker image with tag
run: |
bash ./scripts/ci/build-docker-image.sh \
-r '${{ env.RELEASE_TYPE }}' \
-p '${{ env.PYTHON_PACKAGE_NAME }}' \
-v '${{ env.SOFTWARE_VERSION_FORMAT }}' \
-i '${{ env.DOCKER_IMAGE_NAME }}'
- name: Loging Docker
run: |
docker login -u ${{ env.DOCKER_ACCOUNT }} -p ${{ secrets.DOCKER_ACCOUNT_PWD }}
- name: Release the Docker image to Docker hub
run: |
bash ./scripts/ci/release-docker-image.sh \
-d '${{ env.RUNNING_MODE }}' \
-r '${{ env.RELEASE_TYPE }}' \
-p '${{ env.PYTHON_PACKAGE_NAME }}' \
-v '${{ env.SOFTWARE_VERSION_FORMAT }}' \
-i '${{ env.DOCKER_IMAGE_NAME }}'