@@ -113,14 +113,16 @@ jobs:
113113 # then the use of ${{ github.repository_owner }} will need to be replaced.
114114 images : |
115115 ${{ github.repository_owner }}/minecraft-server
116+ ghcr.io/${{ github.repository_owner }}/minecraft-server
116117 tags : |
117- type=ref,event=tag,enable=${{ matrix.variant == 'java17' }}
118+ type=ref,event=tag,enable=${{ matrix.variant == 'java17' && github.ref == 'master' }}
118119 type=ref,event=tag,suffix=-${{ matrix.variant }}
119- type=raw,value=${{ matrix.variant }}
120+ type=ref,event=branch,suffix=-${{ matrix.variant }},enable=${{ github.ref != 'master' }}
121+ type=raw,value=${{ matrix.variant }},enable=${{ github.ref == 'master' }}
120122 # NOTE this identifies which variant will be published as "latest", which isn't
121123 # necessarily the newest version of Java
122124 flavor : |
123- latest=${{ matrix.variant == 'java17' }}
125+ latest=${{ matrix.variant == 'java17' && github.ref == 'master' }}
124126 labels : |
125127 org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
126128
@@ -150,6 +152,7 @@ jobs:
150152 MINECRAFT_VERSION : ${{ matrix.mcVersion }}
151153 VARIANT : ${{ matrix.variant }}
152154 MODS_FORGEAPI_KEY : ${{ secrets.MODS_FORGEAPI_KEY }}
155+ CF_API_KEY : ${{ secrets.MODS_FORGEAPI_KEY }}
153156 run : |
154157 tests/test.sh
155158
@@ -160,6 +163,14 @@ jobs:
160163 username : ${{ secrets.DOCKER_USER }}
161164 password : ${{ secrets.DOCKER_PASSWORD }}
162165
166+ - name : Login to GHCR
167+ uses : docker/login-action@v2
168+ if : env.HAS_IMAGE_REPO_ACCESS
169+ with :
170+ registry : ghcr.io
171+ username : ${{ github.actor }}
172+ password : ${{ github.token }}
173+
163174 - name : Build and push
164175 uses : docker/build-push-action@v3.3.0
165176 if : github.actor == github.repository_owner
@@ -168,7 +179,8 @@ jobs:
168179 push : >
169180 ${{
170181 github.ref_type == 'tag'
171- || github.ref_name == 'master'
182+ || github.ref_name == 'master'
183+ || startsWith(github.ref_name, 'test/')
172184 || ( github.event_name == 'pull_request'
173185 && env.HAS_IMAGE_REPO_ACCESS
174186 && contains(github.event.pull_request.labels.*.name, 'ci/push-image')
0 commit comments