@@ -17,10 +17,10 @@ jobs:
17
17
runs-on : ${{ matrix.os }}
18
18
timeout-minutes : 60
19
19
steps :
20
- - uses : actions/checkout@v3
20
+ - uses : actions/checkout@v4
21
21
with :
22
22
fetch-depth : 0
23
- - uses : cachix/install-nix-action@v22
23
+ - uses : cachix/install-nix-action@v23
24
24
with :
25
25
# The sandbox would otherwise be disabled by default on Darwin
26
26
extra_nix_config : " sandbox = true"
@@ -58,11 +58,11 @@ jobs:
58
58
outputs :
59
59
installerURL : ${{ steps.prepare-installer.outputs.installerURL }}
60
60
steps :
61
- - uses : actions/checkout@v3
61
+ - uses : actions/checkout@v4
62
62
with :
63
63
fetch-depth : 0
64
64
- 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
66
66
with :
67
67
install_url : https://releases.nixos.org/nix/nix-2.13.3/install
68
68
- uses : cachix/cachix-action@v12
82
82
os : [ubuntu-latest, macos-latest]
83
83
runs-on : ${{ matrix.os }}
84
84
steps :
85
- - uses : actions/checkout@v3
85
+ - uses : actions/checkout@v4
86
86
- 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
88
88
with :
89
89
install_url : ' ${{needs.installer.outputs.installerURL}}'
90
90
install_options : " --tarball-url-prefix https://${{ env.CACHIX_NAME }}.cachix.org/serve"
@@ -101,17 +101,20 @@ jobs:
101
101
102
102
docker_push_image :
103
103
needs : [check_secrets, tests]
104
+ permissions :
105
+ contents : read
106
+ packages : write
104
107
if : >-
105
108
github.event_name == 'push' &&
106
109
github.ref_name == 'master' &&
107
110
needs.check_secrets.outputs.cachix == 'true' &&
108
111
needs.check_secrets.outputs.docker == 'true'
109
112
runs-on : ubuntu-latest
110
113
steps :
111
- - uses : actions/checkout@v3
114
+ - uses : actions/checkout@v4
112
115
with :
113
116
fetch-depth : 0
114
- - uses : cachix/install-nix-action@v22
117
+ - uses : cachix/install-nix-action@v23
115
118
with :
116
119
install_url : https://releases.nixos.org/nix/nix-2.13.3/install
117
120
- run : echo CACHIX_NAME="$(echo $GITHUB_REPOSITORY-install-tests | tr "[A-Z]/" "[a-z]-")" >> $GITHUB_ENV
@@ -126,10 +129,30 @@ jobs:
126
129
- run : docker load -i ./result/image.tar.gz
127
130
- run : docker tag nix:$NIX_VERSION nixos/nix:$NIX_VERSION
128
131
- 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
129
135
- name : Login to Docker Hub
130
- uses : docker/login-action@v2
136
+ uses : docker/login-action@v3
131
137
with :
132
138
username : ${{ secrets.DOCKERHUB_USERNAME }}
133
139
password : ${{ secrets.DOCKERHUB_TOKEN }}
134
140
- run : docker push nixos/nix:$NIX_VERSION
135
141
- 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