This commit is contained in:
@@ -11,6 +11,8 @@ on:
|
|||||||
env:
|
env:
|
||||||
REGISTRY_HOST: git.neosisyphus.com
|
REGISTRY_HOST: git.neosisyphus.com
|
||||||
REGISTRY_IMAGE: git.neosisyphus.com/evol3d/evol-testbed
|
REGISTRY_IMAGE: git.neosisyphus.com/evol3d/evol-testbed
|
||||||
|
# Optional. If this secret is not set, the workflow uses GITHUB_ACTOR.
|
||||||
|
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
image:
|
image:
|
||||||
@@ -21,8 +23,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Log in to container registry
|
- name: Log in to container registry
|
||||||
run: |
|
run: |
|
||||||
|
set -eu
|
||||||
|
username="${REGISTRY_USERNAME:-${GITHUB_ACTOR:-}}"
|
||||||
|
if [ -z "$username" ]; then
|
||||||
|
echo "REGISTRY_USERNAME secret is empty and GITHUB_ACTOR is not set" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "${{ secrets.REGISTRY_PASSWORD }}" ]; then
|
||||||
|
echo "REGISTRY_PASSWORD secret is empty. Set it to a Gitea access token with package write permission." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login "$REGISTRY_HOST" \
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login "$REGISTRY_HOST" \
|
||||||
-u "${{ secrets.REGISTRY_USERNAME }}" \
|
-u "$username" \
|
||||||
--password-stdin
|
--password-stdin
|
||||||
|
|
||||||
- name: Build CI image
|
- name: Build CI image
|
||||||
|
|||||||
+9
-2
@@ -35,15 +35,22 @@ REGISTRY_IMAGE=git.neosisyphus.com/evol3d/evol-testbed
|
|||||||
CI_IMAGE=git.neosisyphus.com/evol3d/evol-testbed
|
CI_IMAGE=git.neosisyphus.com/evol3d/evol-testbed
|
||||||
```
|
```
|
||||||
|
|
||||||
Add these **Actions secrets**:
|
Add this **Actions secret**:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
REGISTRY_USERNAME=your-gitea-username
|
|
||||||
REGISTRY_PASSWORD=your-gitea-token-or-password
|
REGISTRY_PASSWORD=your-gitea-token-or-password
|
||||||
```
|
```
|
||||||
|
|
||||||
The token/password needs permission to publish packages/container images.
|
The token/password needs permission to publish packages/container images.
|
||||||
|
|
||||||
|
Optional: add this secret if your registry username is different from the Gitea Actions actor:
|
||||||
|
|
||||||
|
```text
|
||||||
|
REGISTRY_USERNAME=your-gitea-username
|
||||||
|
```
|
||||||
|
|
||||||
|
If `REGISTRY_USERNAME` is not set, the workflow uses `$GITHUB_ACTOR`.
|
||||||
|
|
||||||
## Build manually
|
## Build manually
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
+11
-10
@@ -169,24 +169,28 @@ In your repository:
|
|||||||
1. Go to **Settings**.
|
1. Go to **Settings**.
|
||||||
2. Go to **Actions**.
|
2. Go to **Actions**.
|
||||||
3. Go to **Secrets**.
|
3. Go to **Secrets**.
|
||||||
4. Add:
|
4. Add this required secret:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
REGISTRY_USERNAME
|
|
||||||
REGISTRY_PASSWORD
|
REGISTRY_PASSWORD
|
||||||
```
|
```
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
REGISTRY_USERNAME=myusername
|
|
||||||
REGISTRY_PASSWORD=<your-gitea-access-token>
|
REGISTRY_PASSWORD=<your-gitea-access-token>
|
||||||
```
|
```
|
||||||
|
|
||||||
Use your Gitea username for `REGISTRY_USERNAME`.
|
|
||||||
|
|
||||||
Use the token from step 3 for `REGISTRY_PASSWORD`.
|
Use the token from step 3 for `REGISTRY_PASSWORD`.
|
||||||
|
|
||||||
|
Optional: add this secret if your registry username is different from the Gitea Actions actor:
|
||||||
|
|
||||||
|
```text
|
||||||
|
REGISTRY_USERNAME=myusername
|
||||||
|
```
|
||||||
|
|
||||||
|
If `REGISTRY_USERNAME` is not set, the workflow uses `$GITHUB_ACTOR`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 6. Check the image build workflow
|
## 6. Check the image build workflow
|
||||||
@@ -592,13 +596,10 @@ This avoids surprise breakage when `clang22` or `latest` changes.
|
|||||||
```text
|
```text
|
||||||
1. Commit ci/Dockerfile and workflows.
|
1. Commit ci/Dockerfile and workflows.
|
||||||
2. Create Gitea token with package/container write access.
|
2. Create Gitea token with package/container write access.
|
||||||
3. Add Actions variables:
|
3. Registry/image values are already hardcoded in the workflow.
|
||||||
- REGISTRY_HOST
|
|
||||||
- REGISTRY_IMAGE
|
|
||||||
- CI_IMAGE
|
|
||||||
4. Add Actions secrets:
|
4. Add Actions secrets:
|
||||||
- REGISTRY_USERNAME
|
|
||||||
- REGISTRY_PASSWORD
|
- REGISTRY_PASSWORD
|
||||||
|
- REGISTRY_USERNAME only if needed
|
||||||
5. Make sure the runner can run docker build.
|
5. Make sure the runner can run docker build.
|
||||||
6. Run build-ci-image workflow.
|
6. Run build-ci-image workflow.
|
||||||
7. Confirm image appears in Gitea Packages.
|
7. Confirm image appears in Gitea Packages.
|
||||||
|
|||||||
Reference in New Issue
Block a user