1+ name : Hotfix Workflow
2+
3+ env :
4+ REGISTRY : docker.io
5+ IMAGE_NAME : ${{ secrets.DOCKER_USERNAME }}/python-template
6+
7+ on :
8+ push :
9+ branches : [ main ]
10+ paths-ignore :
11+ - ' dev/**'
12+
13+ jobs :
14+ hotfix :
15+ if : github.ref != 'refs/heads/dev'
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Checkout repository
19+ uses : actions/checkout@v4
20+
21+ - name : Set up Python
22+ uses : actions/setup-python@v4
23+ with :
24+ python-version : ' 3.x'
25+
26+ - name : Bump patch version and get new tag
27+ id : bump_patch
28+ run : |
29+ NEW_VERSION=$(python3 .github/scripts/bump_patch.py)
30+ echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
31+ echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
32+
33+ - name : Create Git Tag and push (Hotfix)
34+ run : |
35+ git tag ${{ env.VERSION }}
36+ git push origin ${{ env.VERSION }}
37+
38+ - name : Set up QEMU
39+ uses : docker/setup-qemu-action@v3
40+
41+ - name : Set up Docker Buildx
42+ uses : docker/setup-buildx-action@v3
43+
44+ - name : Log in to Docker Hub
45+ uses : docker/login-action@v3
46+ with :
47+ username : ${{ secrets.DOCKER_USERNAME }}
48+ password : ${{ secrets.DOCKER_PASSWORD }}
49+
50+ - name : Build and push Hotfix Docker image
51+ uses : docker/build-push-action@v2
52+ with :
53+ context : .
54+ file : ./Dockerfile
55+ push : true
56+ tags : |
57+ ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
58+ ${{ env.IMAGE_NAME }}:stable
59+ platforms : linux/amd64,linux/arm64
60+
61+ - name : Cherry-pick hotfix into dev branch
62+ run : |
63+ HOTFIX_COMMIT=$(git rev-parse HEAD)
64+ git checkout dev
65+ git cherry-pick $HOTFIX_COMMIT
66+ git push origin dev
67+
68+ - name : Rebuild DEV "latest" Docker image
69+ uses : docker/build-push-action@v2
70+ with :
71+ context : .
72+ file : ./Dockerfile
73+ push : true
74+ tags : |
75+ ${{ env.IMAGE_NAME }}:latest
76+ platforms : linux/amd64,linux/arm64
0 commit comments