CI update

added
Docker on tag
Autotest on mergerequest to main
This commit is contained in:
2026-09-16 20:17:27 +03:00
parent 250ad25df4
commit 762f36beab
11 changed files with 352 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
name: Process redis for auth service
name: Build image
on:
push:
@@ -21,10 +21,12 @@ jobs:
- name: Arch checkout
run: test -f Dockerfile || { echo "Dockerfile not found"; exit 1; }
- name: Login
- name: Login to registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" \
| docker login $REGISTRY -u ${{ gitea.actor }} --password-stdin
| docker login "$REGISTRY" \
-u "${{ secrets.REGISTRY_USER }}" \
--password-stdin
- name: Set Version
id: version
@@ -43,16 +45,44 @@ jobs:
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "REF_TYPE=$REF_TYPE" >> $GITHUB_ENV
- name: Verify release tag belongs to main
if: gitea.ref_type == 'tag'
run: |
git fetch --unshallow origin \
main:refs/remotes/origin/main \
|| git fetch origin \
main:refs/remotes/origin/main
if ! git merge-base \
--is-ancestor \
"${{ gitea.sha }}" \
origin/main
then
echo "ERROR: Release tags must point to a commit from main."
exit 1
fi
- name: Set Python version
run: |
echo "PYTHON_VERSION=$(cat .py-version)" >> "$GITHUB_ENV"
- name: Build Image
run: |
if [ "$REF_TYPE" = "tag" ]; then
docker build --pull --no-cache --provenance=false --sbom=false \
docker build \
--build-arg PYTHON_VERSION="$PYTHON_VERSION" \
--pull --no-cache --provenance=false --sbom=false \
-t $REGISTRY/$REPO:$VERSION \
-t $REGISTRY/$REPO:latest \
.
else
docker build --pull --no-cache --provenance=false --sbom=false \
docker build \
--build-arg PYTHON_VERSION="$PYTHON_VERSION" \
--pull --no-cache --provenance=false --sbom=false \
-t $REGISTRY/$REPO:$VERSION \
.
fi
@@ -69,4 +99,9 @@ jobs:
- name: Notify success
if: success()
run: |
MESSAGE="Built image: \`${{ env.REGISTRY }}/${{ env.REPO }}:${{ env.VERSION }}\`\nBranch: \`${{ gitea.ref_name }}\`\nCommit: \`${{ gitea.sha }}\`"
MESSAGE="Built image: \`${{ env.REGISTRY }}/${{ env.REPO }}:${{ env.VERSION }}\`\nBranch: \`${{ gitea.ref_name }}\`\nCommit: \`${{ gitea.sha }}\`"
- name: Logout
if: always()
run: |
docker logout "$REGISTRY"