Enhance Docker build workflow with registry token validation
- Added a check in docker-build.yml to ensure the REGISTRY_TOKEN is set before attempting to log in to the Gitea Container Registry. - Included an error message to guide users in adding the necessary secret for successful authentication.
This commit is contained in:
@@ -28,8 +28,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "host=${GITHUB_SERVER_URL#https://}" >> $GITHUB_OUTPUT
|
echo "host=${GITHUB_SERVER_URL#https://}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# REGISTRY_TOKEN: Personal Access Token с правом write:package (или токен из Package Registry)
|
||||||
- name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
run: |
|
run: |
|
||||||
|
if [ -z "${{ secrets.REGISTRY_TOKEN }}" ]; then
|
||||||
|
echo "::error::REGISTRY_TOKEN не задан. Добавьте секрет с токеном (scope: write:package)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ steps.registry.outputs.host }} -u ${{ github.actor }} --password-stdin
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ steps.registry.outputs.host }} -u ${{ github.actor }} --password-stdin
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
|
|||||||
Reference in New Issue
Block a user