ci: set the image registry explicitly
- use REGISTRY (git.hq.ars9.space) for login and image tags instead of deriving it from the server url, which is the runner's registration address and may be internal-only - document how jobs reach gitea when the runner uses an internal address
This commit is contained in:
1 parent
f24a1b7dd5
commit
cafc126d1b
2 files changed
+11
-6
No files matched your search
@@ -4,7 +4,9 @@
|
||||
# version and `latest`.
|
||||
#
|
||||
# Needs a repository (or owner) secret REGISTRY_TOKEN: a Gitea access token
|
||||
# with package write access for the repository owner.
|
||||
# with package write access for the repository owner. The registry host is
|
||||
# set explicitly below rather than taken from the server URL, which is the
|
||||
# address the runner was registered with and may be internal-only.
|
||||
|
||||
name: CI
|
||||
|
||||
@@ -13,6 +15,9 @@ on:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
REGISTRY: git.hq.ars9.space
|
||||
|
||||
jobs:
|
||||
server:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -91,10 +96,8 @@ jobs:
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
OWNER: ${{ github.repository_owner }}
|
||||
run: |
|
||||
registry="${GITHUB_SERVER_URL#*://}"
|
||||
echo "REGISTRY=${registry}" >> "$GITHUB_ENV"
|
||||
echo "IMAGE=${registry}/$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
|
||||
echo "$REGISTRY_TOKEN" | docker login "$registry" -u "$OWNER" --password-stdin
|
||||
echo "IMAGE=${REGISTRY}/$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
|
||||
echo "$REGISTRY_TOKEN" | docker login "$REGISTRY" -u "$OWNER" --password-stdin
|
||||
- name: Build
|
||||
run: docker build -t "${IMAGE}:${VERSION}" -t "${IMAGE}:latest" .
|
||||
- name: Push
|
||||
|
||||
Reference in new issue
Block a user