@@ -17,10 +17,10 @@ jobs:
1717 runs-on : ${{ matrix.os }}
1818 timeout-minutes : 60
1919 steps :
20- - uses : actions/checkout@v3
20+ - uses : actions/checkout@v4
2121 with :
2222 fetch-depth : 0
23- - uses : cachix/install-nix-action@v22
23+ - uses : cachix/install-nix-action@v23
2424 with :
2525 # The sandbox would otherwise be disabled by default on Darwin
2626 extra_nix_config : " sandbox = true"
@@ -58,11 +58,11 @@ jobs:
5858 outputs :
5959 installerURL : ${{ steps.prepare-installer.outputs.installerURL }}
6060 steps :
61- - uses : actions/checkout@v3
61+ - uses : actions/checkout@v4
6262 with :
6363 fetch-depth : 0
6464 - run : echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
65- - uses : cachix/install-nix-action@v22
65+ - uses : cachix/install-nix-action@v23
6666 with :
6767 install_url : https://releases.nixos.org/nix/nix-2.13.3/install
6868 - uses : cachix/cachix-action@v12
8282 os : [ubuntu-latest, macos-latest]
8383 runs-on : ${{ matrix.os }}
8484 steps :
85- - uses : actions/checkout@v3
85+ - uses : actions/checkout@v4
8686 - run : echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
87- - uses : cachix/install-nix-action@v22
87+ - uses : cachix/install-nix-action@v23
8888 with :
8989 install_url : ' ${{needs.installer.outputs.installerURL}}'
9090 install_options : " --tarball-url-prefix https://${{ env.CACHIX_NAME }}.cachix.org/serve"
@@ -101,17 +101,20 @@ jobs:
101101
102102 docker_push_image :
103103 needs : [check_secrets, tests]
104+ permissions :
105+ contents : read
106+ packages : write
104107 if : >-
105108 github.event_name == 'push' &&
106109 github.ref_name == 'master' &&
107110 needs.check_secrets.outputs.cachix == 'true' &&
108111 needs.check_secrets.outputs.docker == 'true'
109112 runs-on : ubuntu-latest
110113 steps :
111- - uses : actions/checkout@v3
114+ - uses : actions/checkout@v4
112115 with :
113116 fetch-depth : 0
114- - uses : cachix/install-nix-action@v22
117+ - uses : cachix/install-nix-action@v23
115118 with :
116119 install_url : https://releases.nixos.org/nix/nix-2.13.3/install
117120 - run : echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
@@ -126,10 +129,30 @@ jobs:
126129 - run : docker load -i ./result/image.tar.gz
127130 - run : docker tag nix:$NIX_VERSION nixos/nix:$NIX_VERSION
128131 - run : docker tag nix:$NIX_VERSION nixos/nix:master
132+ # We'll deploy the newly built image to both Docker Hub and Github Container Registry.
133+ #
134+ # Push to Docker Hub first
129135 - name : Login to Docker Hub
130- uses : docker/login-action@v2
136+ uses : docker/login-action@v3
131137 with :
132138 username : ${{ secrets.DOCKERHUB_USERNAME }}
133139 password : ${{ secrets.DOCKERHUB_TOKEN }}
134140 - run : docker push nixos/nix:$NIX_VERSION
135141 - run : docker push nixos/nix:master
142+ # Push to GitHub Container Registry as well
143+ - name : Login to GitHub Container Registry
144+ uses : docker/login-action@v3
145+ with :
146+ registry : ghcr.io
147+ username : ${{ github.actor }}
148+ password : ${{ secrets.GITHUB_TOKEN }}
149+ - name : Push image
150+ run : |
151+ IMAGE_ID=ghcr.io/${{ github.repository_owner }}/nix
152+ # Change all uppercase to lowercase
153+ IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
154+
155+ docker tag nix:$NIX_VERSION $IMAGE_ID:$NIX_VERSION
156+ docker tag nix:$NIX_VERSION $IMAGE_ID:master
157+ docker push $IMAGE_ID:$NIX_VERSION
158+ docker push $IMAGE_ID:master
0 commit comments