Configure registry auth for Gitea builds
All checks were successful
Build and deploy Backend / build (push) Successful in 4m0s
All checks were successful
Build and deploy Backend / build (push) Successful in 4m0s
This commit is contained in:
@@ -5,10 +5,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: build-host
|
runs-on: build-host
|
||||||
@@ -19,11 +15,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Log in to Gitea registry
|
- name: Configure Gitea registry auth
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.GITEA_TOKEN }}" | docker login gitea.dsrptlab.com \
|
set -euo pipefail
|
||||||
-u "${{ github.actor }}" \
|
mkdir -p ~/.docker
|
||||||
--password-stdin
|
auth="$(printf '%s:%s' "${{ secrets.REGISTRY_USERNAME }}" "${{ secrets.REGISTRY_TOKEN }}" | base64 | tr -d '\n')"
|
||||||
|
printf '{"auths":{"gitea.dsrptlab.com":{"auth":"%s"}}}\n' "$auth" > ~/.docker/config.json
|
||||||
|
|
||||||
- name: Build and push image
|
- name: Build and push image
|
||||||
run: |
|
run: |
|
||||||
@@ -51,7 +48,7 @@ jobs:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
[ -f .deploy-current ] || exit 0
|
[ -f .deploy-current ] || exit 0
|
||||||
payload=$(cat <<JSON
|
payload=$(cat <<JSON
|
||||||
{"applicationId":"$DOKPLOY_APPLICATION_ID","dockerImage":"$IMAGE","username":"${{ github.actor }}","password":"${{ secrets.GITEA_TOKEN }}","registryUrl":"gitea.dsrptlab.com"}
|
{"applicationId":"$DOKPLOY_APPLICATION_ID","dockerImage":"$IMAGE","username":"${{ secrets.REGISTRY_USERNAME }}","password":"${{ secrets.REGISTRY_TOKEN }}","registryUrl":"gitea.dsrptlab.com"}
|
||||||
JSON
|
JSON
|
||||||
)
|
)
|
||||||
curl -fsS -X POST "${{ secrets.DOKPLOY_URL }}/api/application.saveDockerProvider" \
|
curl -fsS -X POST "${{ secrets.DOKPLOY_URL }}/api/application.saveDockerProvider" \
|
||||||
|
|||||||
Reference in New Issue
Block a user