8000 Keep GHCR builds green when visibility is private by dominicletz · Pull Request #6 · dominicletz/agentyard · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Oct 16, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
25 changes: 14 additions & 11 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,20 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Make GHCR package public
- name: Make GHCR package public (best effort)
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
# This idempotent PATCH returns success when the package is already public.
curl --fail-with-body --silent --show-error \
--request PATCH \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${GH_TOKEN}" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--header "Content-Type: application/json" \
--data '{"visibility":"public"}' \
"${{ github.api_url }}/user/packages/container/agentyard"
# packages: write permits publishing, but not changing package visibility.
if ! curl --fail-with-body --silent --show-error \
--request PATCH \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${GITHUB_TOKEN}" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--header "Content-Type: application/json" \
--data '{"visibility":"public"}' \
"${{ github.api_url }}/user/packages/container/agentyard"; then
echo "::warning::GitHub could not change GHCR package visibility with GITHUB_TOKEN (the API currently returns 404). Set agentyard to Public once in Package settings; see the production deploy instructions in README.md."
fi
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,22 @@ these GitHub Actions secrets:
- `DEPLOY_PORT` — optional SSH port, default `22`.
- `DEPLOY_PATH` — optional remote directory, default `/opt/agentyard`.

If the GHCR package is private, also configure `GHCR_USERNAME` and a
`GHCR_TOKEN` with permission to read packages, or log in to GHCR on the server
during bootstrap. The workflow never copies or replaces the server's `.env`;
it copies the production Compose files and `.env.prod.example` on each deploy
so those files stay in sync.
The image workflow can publish with its `GITHUB_TOKEN` and `packages: write`
permission, but GitHub does not allow that token to change package visibility.
The workflow reports this as a warning so a successful image push stays green.
Before the first production deploy, make the package public once in GitHub:

1. Open the
[`agentyard` package settings](https://github.com/users/dominicletz/packages/container/agentyard/settings).
2. Under **Danger Zone**, choose **Change visibility**, select **Public**, and
confirm the package name.

Public GHCR container packages support anonymous pulls, so the normal deploy
does not need `GHCR_USERNAME` or `GHCR_TOKEN`. If the package must remain
private, configure those optional secrets with a token that can read packages,
or log in to GHCR on the server during bootstrap. The workflow never copies or
replaces the server's `.env`; it copies the production Compose files and
`.env.prod.example` on each deploy so those files stay in sync.

The server needs Docker, the Docker Compose plugin, and an SSH user in the
`docker` group. A first-time setup is:
Expand Down
Loading
0