Skip to content

Commit

Permalink
fix: CI
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Nützi <gnuetzi@gmail.com>
  • Loading branch information
gabyx committed Jul 9, 2024
1 parent 9410494 commit 652eae9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/normal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions: read-all

defaults:
run:
shell: bash
Expand Down Expand Up @@ -138,7 +140,7 @@ jobs:
- name: Build package (nix)
run: |
just nix-develop-ci nix-package
just nix-develop-ci just nix-package
- name: Build container image (nix)
run: |
Expand All @@ -153,6 +155,9 @@ jobs:

if: ${{ inputs.is_release }}

permissions:
packages: write

env:
CI_IS_RELEASE: true

Expand All @@ -176,6 +181,9 @@ jobs:
just nix-develop-ci just nix-image
- name: Push image (if release)
env:
REGISTRY_USERNAME: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
just nix-develop-ci tools/ci/upload-image.sh
Expand Down
10 changes: 10 additions & 0 deletions tools/ci/upload-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ ROOT_DIR=$(git rev-parse --show-toplevel)
cd "$ROOT_DIR"

function main() {

local username=${REGISTRY_USERNAME:-$USERNAME}
local password=${REGISTRY_PASSWORD:-$PASSWORD}

if [ -z "$username" ] || [ -z "$password" ]; then
die "'USERNAME' or 'PASSWORD' env. variables not set."
fi

if ! ci_is_running; then
die "This script should only be executed in CI"
fi
Expand All @@ -33,6 +41,8 @@ function main() {
skopeo \
--insecure-policy \
copy \
--dest-username <(echo "$username") \
--dest-password <(echo "$password") \
--dest-authfile "$HOME/.docker/config.json" \
"docker-archive://$image_path" \
"docker://$image_name"
Expand Down

0 comments on commit 652eae9

Please sign in to comment.