Skip to content

Commit

Permalink
ci: also publish to GitHub Packages
Browse files Browse the repository at this point in the history
Allow Github users to not have another external dependency.
  • Loading branch information
zimbatm committed Jul 23, 2024
1 parent 5a36736 commit fe9bda3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
schedule:
# Run once per day
- cron: '0 0 * * *'

jobs:
build:
strategy:
Expand All @@ -20,7 +21,19 @@ jobs:
system:
- x86_64-linux
- aarch64-linux
registry:
- name: ghcr.io
image_prefix: nix-community/docker-nixpkgs
auth: "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}"
- name: ghcr.io
image_prefix: nixpkgs
auth: "${{ secrets.REGISTRY_AUTH }}"
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- name: Set up QEMU
Expand All @@ -33,13 +46,23 @@ jobs:
extra-platforms = aarch64-linux
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Log in to the Container registry
if: "${{ matrix.registry.name == 'ghcr.io' }}"
uses: docker/[email protected]
with:
registry: ${{ matrix.registry.name }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- run: nix-shell --run ./ci.sh
env:
CI_REGISTRY_AUTH: '${{ secrets.REGISTRY_AUTH }}'
CI_PROJECT_PATH: '${{ matrix.registry.image_prefix }}'
CI_REGISTRY: '${{ matrix.registry.name }}'
CI_REGISTRY_AUTH: '${{ matrix.registry.auth }}'
NIXPKGS_CHANNEL: '${{ matrix.channel }}'
NIX_SYSTEM_NAME: '${{ matrix.system }}'

push-manifest:
push-manifest-to-docker-hub:
needs: [build]
strategy:
fail-fast: false
Expand Down
5 changes: 0 additions & 5 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,3 @@ fi

banner "docker push"
./push-all "$registry" "$image_prefix" "$image_tag"

if [[ -n "${registry_auth}" && $registry = *docker.io ]]; then
banner "docker metadata update"
./dockerhub-metadata "$registry_auth" "$image_prefix"
fi

0 comments on commit fe9bda3

Please sign in to comment.