This commit is contained in:
@@ -7,7 +7,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: wdw-sitemap-and-importer
|
LOCAL_IMAGE_NAME: wdw-sitemap-and-importer
|
||||||
REGISTRY: ${{ secrets.REGISTRY_URL }}
|
REGISTRY: ${{ secrets.REGISTRY_URL }}
|
||||||
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
@@ -20,10 +20,10 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build image
|
- name: Build image
|
||||||
run: docker build -t "${IMAGE_NAME}:${{ gitea.sha }}" .
|
run: docker build -t "${LOCAL_IMAGE_NAME}:${{ gitea.sha }}" .
|
||||||
|
|
||||||
- name: Tag latest image
|
- name: Tag latest image
|
||||||
run: docker tag "${IMAGE_NAME}:${{ gitea.sha }}" "${IMAGE_NAME}:latest"
|
run: docker tag "${LOCAL_IMAGE_NAME}:${{ gitea.sha }}" "${LOCAL_IMAGE_NAME}:latest"
|
||||||
|
|
||||||
- name: Log in and push image
|
- name: Log in and push image
|
||||||
run: |
|
run: |
|
||||||
@@ -33,10 +33,18 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${REGISTRY_PASSWORD}" | docker login "${REGISTRY}" -u "${REGISTRY_USERNAME}" --password-stdin
|
REGISTRY_HOST="${REGISTRY#http://}"
|
||||||
|
REGISTRY_HOST="${REGISTRY_HOST#https://}"
|
||||||
|
REGISTRY_HOST="${REGISTRY_HOST%/}"
|
||||||
|
IMAGE_REPOSITORY="$(printf '%s' '${{ gitea.repository }}' | tr '[:upper:]' '[:lower:]')"
|
||||||
|
FULL_IMAGE="${REGISTRY_HOST}/${IMAGE_REPOSITORY}"
|
||||||
|
|
||||||
docker tag "${IMAGE_NAME}:${{ gitea.sha }}" "${REGISTRY}/${IMAGE_NAME}:${{ gitea.sha }}"
|
echo "Pushing image to ${FULL_IMAGE}"
|
||||||
docker tag "${IMAGE_NAME}:latest" "${REGISTRY}/${IMAGE_NAME}:latest"
|
|
||||||
|
|
||||||
docker push "${REGISTRY}/${IMAGE_NAME}:${{ gitea.sha }}"
|
echo "${REGISTRY_PASSWORD}" | docker login "${REGISTRY_HOST}" -u "${REGISTRY_USERNAME}" --password-stdin
|
||||||
docker push "${REGISTRY}/${IMAGE_NAME}:latest"
|
|
||||||
|
docker tag "${LOCAL_IMAGE_NAME}:${{ gitea.sha }}" "${FULL_IMAGE}:${{ gitea.sha }}"
|
||||||
|
docker tag "${LOCAL_IMAGE_NAME}:latest" "${FULL_IMAGE}:latest"
|
||||||
|
|
||||||
|
docker push "${FULL_IMAGE}:${{ gitea.sha }}"
|
||||||
|
docker push "${FULL_IMAGE}:latest"
|
||||||
|
|||||||
@@ -98,8 +98,22 @@ The workflow always builds the Docker image. If these secrets are configured in
|
|||||||
|
|
||||||
Published tags:
|
Published tags:
|
||||||
|
|
||||||
- `${REGISTRY}/wdw-sitemap-and-importer:<commit-sha>`
|
- `${REGISTRY_URL}/wdw_internal_tools/wdw-sitemap-and-scraper-docker:<commit-sha>`
|
||||||
- `${REGISTRY}/wdw-sitemap-and-importer:latest`
|
- `${REGISTRY_URL}/wdw_internal_tools/wdw-sitemap-and-scraper-docker:latest`
|
||||||
|
|
||||||
|
`REGISTRY_URL` should be the registry host only, for example:
|
||||||
|
|
||||||
|
```text
|
||||||
|
registry.example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
|
```text
|
||||||
|
gitea.example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
Do not include `http://`, `https://`, or the repository path in `REGISTRY_URL`. The workflow derives the repository path from the Gitea repository name and converts it to lowercase for Docker compatibility.
|
||||||
|
|
||||||
If the registry secrets are not configured, the workflow still performs the build as validation but skips the push steps.
|
If the registry secrets are not configured, the workflow still performs the build as validation but skips the push steps.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user