✨ Feature: Add support for Docker version number
Browse files- .github/workflows/main.yml +21 -1
- VERSION +1 -0
.github/workflows/main.yml
CHANGED
@@ -5,6 +5,7 @@ on:
|
|
5 |
branches:
|
6 |
- main
|
7 |
paths:
|
|
|
8 |
- main.py
|
9 |
- utils.py
|
10 |
- models.py
|
@@ -36,6 +37,23 @@ jobs:
|
|
36 |
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
37 |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
- name: Build and push Docker image
|
40 |
uses: docker/[email protected]
|
41 |
with:
|
@@ -43,4 +61,6 @@ jobs:
|
|
43 |
file: Dockerfile
|
44 |
platforms: linux/amd64,linux/arm64
|
45 |
push: true
|
46 |
-
tags:
|
|
|
|
|
|
5 |
branches:
|
6 |
- main
|
7 |
paths:
|
8 |
+
- VERSION
|
9 |
- main.py
|
10 |
- utils.py
|
11 |
- models.py
|
|
|
37 |
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
38 |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
39 |
|
40 |
+
- name: Get current version
|
41 |
+
id: get_version
|
42 |
+
run: |
|
43 |
+
VERSION=$(cat VERSION || echo "0.0.0")
|
44 |
+
echo "Current version: $VERSION"
|
45 |
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
46 |
+
|
47 |
+
- name: Bump version
|
48 |
+
id: bump_version
|
49 |
+
run: |
|
50 |
+
IFS='.' read -ra VERSION_PARTS <<< "${{ steps.get_version.outputs.version }}"
|
51 |
+
PATCH=$((VERSION_PARTS[2] + 1))
|
52 |
+
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$PATCH"
|
53 |
+
echo $NEW_VERSION > VERSION
|
54 |
+
echo "New version: $NEW_VERSION"
|
55 |
+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
56 |
+
|
57 |
- name: Build and push Docker image
|
58 |
uses: docker/[email protected]
|
59 |
with:
|
|
|
61 |
file: Dockerfile
|
62 |
platforms: linux/amd64,linux/arm64
|
63 |
push: true
|
64 |
+
tags: |
|
65 |
+
yym68686/uni-api:latest
|
66 |
+
yym68686/uni-api:${{ steps.bump_version.outputs.new_version }}
|
VERSION
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
0.0.0
|