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:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
read-conditions:
|
||||
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:
|
||||
- name: Checkout repository
|
||||
run: |
|
||||
git clone https://oauth2:${{ secrets.GITEATOKEN }}@direct-dev.ru/gitea/GiteaAdmin/hello_gitea.git hello_gitea
|
||||
cd hello_gitea
|
||||
git checkout ${{ github.ref }}
|
||||
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' }}
|
||||
|
||||
- name: Parse build conditions
|
||||
id: parse-conditions
|
||||
jobs:
|
||||
debug-conditions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Show build 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
|
||||
echo "Build conditions:"
|
||||
echo " BUILD_CREATE_RELEASE: $BUILD_CREATE_RELEASE"
|
||||
echo " BUILD_CREATE_DOCKER_IMAGE: $BUILD_CREATE_DOCKER_IMAGE"
|
||||
echo " BUILD_UPDATE_RELEASE_BRANCH: $BUILD_UPDATE_RELEASE_BRANCH"
|
||||
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: read-conditions
|
||||
if: needs.read-conditions.outputs.create-release == '1'
|
||||
if: env.BUILD_CREATE_RELEASE == '1'
|
||||
container:
|
||||
image: ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:latest
|
||||
steps:
|
||||
@@ -161,8 +119,8 @@ jobs:
|
||||
|
||||
create-docker-image:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [read-conditions, create-release]
|
||||
if: needs.read-conditions.outputs.create-docker-image == '1' && (needs.create-release.result == 'success' || needs.create-release.result == 'skipped')
|
||||
needs: create-release
|
||||
if: env.BUILD_CREATE_DOCKER_IMAGE == '1' && (needs.create-release.result == 'success' || needs.create-release.result == 'skipped')
|
||||
container:
|
||||
image: docker:28.3.2-dind
|
||||
steps:
|
||||
@@ -213,8 +171,8 @@ jobs:
|
||||
|
||||
update-to-release-branch:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [read-conditions, 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')
|
||||
needs: create-docker-image
|
||||
if: env.BUILD_UPDATE_RELEASE_BRANCH == '1' && (needs.create-docker-image.result == 'success' || needs.create-docker-image.result == 'skipped')
|
||||
container:
|
||||
image: docker:28.3.2-dind
|
||||
steps:
|
||||
|
Reference in New Issue
Block a user