Release v1.0.50
All checks were successful
Conditional Release Build / debug-conditions (push) Successful in 5s
Conditional Release Build / create-release (push) Has been skipped
Conditional Release Build / update-to-release-branch (push) Has been skipped
Conditional Release Build / create-docker-image (push) Has been skipped
All checks were successful
Conditional Release Build / debug-conditions (push) Successful in 5s
Conditional Release Build / create-release (push) Has been skipped
Conditional Release Build / update-to-release-branch (push) Has been skipped
Conditional Release Build / create-docker-image (push) Has been skipped
This commit is contained in:
@@ -4,68 +4,26 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- v*
|
- v*
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Можно переопределить через секреты или переменные
|
||||||
|
BUILD_CREATE_RELEASE: ${{ secrets.BUILD_CREATE_RELEASE || vars.BUILD_CREATE_RELEASE || '1' }}
|
||||||
|
BUILD_CREATE_DOCKER_IMAGE: ${{ secrets.BUILD_CREATE_DOCKER_IMAGE || vars.BUILD_CREATE_DOCKER_IMAGE || '1' }}
|
||||||
|
BUILD_UPDATE_RELEASE_BRANCH: ${{ secrets.BUILD_UPDATE_RELEASE_BRANCH || vars.BUILD_UPDATE_RELEASE_BRANCH || '1' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
read-conditions:
|
debug-conditions:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
|
||||||
create-release: ${{ steps.parse-conditions.outputs.create-release }}
|
|
||||||
create-docker-image: ${{ steps.parse-conditions.outputs.create-docker-image }}
|
|
||||||
update-to-release-branch: ${{ steps.parse-conditions.outputs.update-to-release-branch }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Show build conditions
|
||||||
run: |
|
run: |
|
||||||
git clone https://oauth2:${{ secrets.GITEATOKEN }}@direct-dev.ru/gitea/GiteaAdmin/hello_gitea.git hello_gitea
|
echo "Build conditions:"
|
||||||
cd hello_gitea
|
echo " BUILD_CREATE_RELEASE: $BUILD_CREATE_RELEASE"
|
||||||
git checkout ${{ github.ref }}
|
echo " BUILD_CREATE_DOCKER_IMAGE: $BUILD_CREATE_DOCKER_IMAGE"
|
||||||
|
echo " BUILD_UPDATE_RELEASE_BRANCH: $BUILD_UPDATE_RELEASE_BRANCH"
|
||||||
- name: Parse build conditions
|
|
||||||
id: parse-conditions
|
|
||||||
run: |
|
|
||||||
cd hello_gitea
|
|
||||||
|
|
||||||
# Default values if file doesn't exist
|
|
||||||
CREATE_RELEASE="1"
|
|
||||||
CREATE_DOCKER_IMAGE="1"
|
|
||||||
UPDATE_TO_RELEASE_BRANCH="1"
|
|
||||||
|
|
||||||
# Read conditions from file if it exists
|
|
||||||
if [ -f .build.conditions ]; then
|
|
||||||
echo "Reading .build.conditions file..."
|
|
||||||
while IFS=':' read -r job condition; do
|
|
||||||
# Remove leading/trailing whitespace
|
|
||||||
job=$(echo "$job" | xargs)
|
|
||||||
condition=$(echo "$condition" | xargs)
|
|
||||||
|
|
||||||
case "$job" in
|
|
||||||
"create-release")
|
|
||||||
CREATE_RELEASE="$condition"
|
|
||||||
;;
|
|
||||||
"create-docker-image")
|
|
||||||
CREATE_DOCKER_IMAGE="$condition"
|
|
||||||
;;
|
|
||||||
"update-to-release-branch")
|
|
||||||
UPDATE_TO_RELEASE_BRANCH="$condition"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done < .build.conditions
|
|
||||||
|
|
||||||
echo "Parsed conditions:"
|
|
||||||
echo " create-release: $CREATE_RELEASE"
|
|
||||||
echo " create-docker-image: $CREATE_DOCKER_IMAGE"
|
|
||||||
echo " update-to-release-branch: $UPDATE_TO_RELEASE_BRANCH"
|
|
||||||
else
|
|
||||||
echo "No .build.conditions file found, using defaults"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set outputs
|
|
||||||
echo "create-release=$CREATE_RELEASE" >> $GITHUB_OUTPUT
|
|
||||||
echo "create-docker-image=$CREATE_DOCKER_IMAGE" >> $GITHUB_OUTPUT
|
|
||||||
echo "update-to-release-branch=$UPDATE_TO_RELEASE_BRANCH" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
create-release:
|
create-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: read-conditions
|
if: env.BUILD_CREATE_RELEASE == '1'
|
||||||
if: needs.read-conditions.outputs.create-release == '1'
|
|
||||||
container:
|
container:
|
||||||
image: ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:latest
|
image: ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:latest
|
||||||
steps:
|
steps:
|
||||||
@@ -161,8 +119,8 @@ jobs:
|
|||||||
|
|
||||||
create-docker-image:
|
create-docker-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [read-conditions, create-release]
|
needs: create-release
|
||||||
if: needs.read-conditions.outputs.create-docker-image == '1' && (needs.create-release.result == 'success' || needs.create-release.result == 'skipped')
|
if: env.BUILD_CREATE_DOCKER_IMAGE == '1' && (needs.create-release.result == 'success' || needs.create-release.result == 'skipped')
|
||||||
container:
|
container:
|
||||||
image: docker:28.3.2-dind
|
image: docker:28.3.2-dind
|
||||||
steps:
|
steps:
|
||||||
@@ -213,8 +171,8 @@ jobs:
|
|||||||
|
|
||||||
update-to-release-branch:
|
update-to-release-branch:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [read-conditions, create-docker-image]
|
needs: create-docker-image
|
||||||
if: needs.read-conditions.outputs.update-to-release-branch == '1' && (needs.create-docker-image.result == 'success' || needs.create-docker-image.result == 'skipped')
|
if: env.BUILD_UPDATE_RELEASE_BRANCH == '1' && (needs.create-docker-image.result == 'success' || needs.create-docker-image.result == 'skipped')
|
||||||
container:
|
container:
|
||||||
image: docker:28.3.2-dind
|
image: docker:28.3.2-dind
|
||||||
steps:
|
steps:
|
||||||
|
Reference in New Issue
Block a user