Switch to GITHUB_TOKEN allowing only the action to trigger an update. Not necessary if public but doesn't harm anything and can cover if private.
This commit is contained in:
parent
c9186ea923
commit
5ca801bdd1
1 changed files with 5 additions and 5 deletions
10
.github/workflows/build-and-deploy.yml
vendored
10
.github/workflows/build-and-deploy.yml
vendored
|
|
@ -72,8 +72,8 @@ jobs:
|
||||||
- name: Deploy to server via SSH ☁️
|
- name: Deploy to server via SSH ☁️
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
env:
|
env:
|
||||||
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
|
RUNNER_GH_ACTOR: ${{ github.actor }}
|
||||||
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
|
RUNNER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.SERVER_HOST }}
|
host: ${{ secrets.SERVER_HOST }}
|
||||||
username: ${{ secrets.SERVER_USERNAME }}
|
username: ${{ secrets.SERVER_USERNAME }}
|
||||||
|
|
@ -83,9 +83,9 @@ jobs:
|
||||||
cd /home/github-actions/codered-astra
|
cd /home/github-actions/codered-astra
|
||||||
# wrapper to support both Docker Compose v2 and legacy v1
|
# wrapper to support both Docker Compose v2 and legacy v1
|
||||||
compose() { docker compose "$@" || docker-compose "$@"; }
|
compose() { docker compose "$@" || docker-compose "$@"; }
|
||||||
# Log in to GHCR to pull private images (requires GHCR_USERNAME and GHCR_TOKEN envs)
|
# Log in to GHCR using the run's GITHUB_TOKEN so compose can pull images.
|
||||||
if [ -n "$GHCR_USERNAME" ] && [ -n "$GHCR_TOKEN" ]; then
|
if [ -n "$RUNNER_GITHUB_TOKEN" ] && [ -n "$RUNNER_GH_ACTOR" ]; then
|
||||||
echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
|
echo "$RUNNER_GITHUB_TOKEN" | docker login ghcr.io -u "$RUNNER_GH_ACTOR" --password-stdin || true
|
||||||
fi
|
fi
|
||||||
export REPO_NAME_LOWER='${{ steps.repo_name.outputs.name }}'
|
export REPO_NAME_LOWER='${{ steps.repo_name.outputs.name }}'
|
||||||
export GEMINI_API_KEY='${{ secrets.GEMINI_API_KEY }}'
|
export GEMINI_API_KEY='${{ secrets.GEMINI_API_KEY }}'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue