fix(ci-build): update conditions for push permissions in CI workflow
This commit is contained in:
@@ -27,10 +27,10 @@ jobs:
|
|||||||
event_name="${GITHUB_EVENT_NAME:-}"
|
event_name="${GITHUB_EVENT_NAME:-}"
|
||||||
sha="${GITHUB_SHA:-}"
|
sha="${GITHUB_SHA:-}"
|
||||||
|
|
||||||
if [ "$ref_name" = "${DEFAULT_BRANCH:-main}" ]; then
|
if [ "$ref_name" = "${DEFAULT_BRANCH:-main}" ] && [ "$event_name" != "pull_request" ]; then
|
||||||
echo "on_default=true" >> "$GITHUB_OUTPUT"
|
echo "allow_push=true" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "on_default=false" >> "$GITHUB_OUTPUT"
|
echo "allow_push=false" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "ref_name=$ref_name" >> "$GITHUB_OUTPUT"
|
echo "ref_name=$ref_name" >> "$GITHUB_OUTPUT"
|
||||||
@@ -41,7 +41,7 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to gitea registry
|
- name: Log in to gitea registry
|
||||||
if: ${{ steps.meta.outputs.on_default == 'true' }}
|
if: ${{ steps.meta.outputs.allow_push == 'true' }}
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
REGISTRY_URL: ${{ env.REGISTRY_URL }}
|
REGISTRY_URL: ${{ env.REGISTRY_URL }}
|
||||||
REGISTRY_CONTAINER_NAME: ${{ env.REGISTRY_CONTAINER_NAME }}
|
REGISTRY_CONTAINER_NAME: ${{ env.REGISTRY_CONTAINER_NAME }}
|
||||||
SHA_TAG: ${{ steps.meta.outputs.sha }}
|
SHA_TAG: ${{ steps.meta.outputs.sha }}
|
||||||
PUSH_IMAGE: ${{ steps.meta.outputs.on_default == 'true' && steps.meta.outputs.event_name != 'pull_request' && env.REGISTRY_URL != '' && env.REGISTRY_USERNAME != '' && env.REGISTRY_PASSWORD != '' }}
|
PUSH_IMAGE: ${{ steps.meta.outputs.allow_push == 'true' && env.REGISTRY_URL != '' && env.REGISTRY_USERNAME != '' && env.REGISTRY_PASSWORD != '' }}
|
||||||
run: |
|
run: |
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
LOG_FILE=build.log
|
LOG_FILE=build.log
|
||||||
|
|||||||
Reference in New Issue
Block a user