Skip to content

Commit 5830d28

Browse files
committed
fix(ci): auto-set package visibility to public after publishing
Add step to each build job that calls GitHub API to set package visibility to public after successful push to ghcr.io.
1 parent b5df7f3 commit 5830d28

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/docker-publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ jobs:
6565
cache-from: type=gha,scope=base-system
6666
cache-to: type=gha,mode=max,scope=base-system
6767

68+
- name: Make package public
69+
run: |
70+
gh api --method PUT /orgs/${{ github.repository_owner }}/packages/container/devcontainers%2Fbase-system/visibility \
71+
-f visibility=public || true
72+
env:
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
6875
build-intermediate:
6976
if: github.event_name == 'push' || inputs.layer == 'all' || inputs.layer == 'intermediate'
7077
needs: build-base
@@ -105,6 +112,13 @@ jobs:
105112
build-contexts: |
106113
base-system:latest=docker-image://${{ env.IMAGE_PREFIX }}/base-system:latest
107114
115+
- name: Make package public
116+
run: |
117+
gh api --method PUT /orgs/${{ github.repository_owner }}/packages/container/devcontainers%2F${{ matrix.image }}/visibility \
118+
-f visibility=public || true
119+
env:
120+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
108122
build-infra-base:
109123
if: github.event_name == 'push' || inputs.layer == 'all' || inputs.layer == 'infra'
110124
needs: build-base
@@ -158,6 +172,13 @@ jobs:
158172
build-contexts: |
159173
base-system:latest=docker-image://${{ env.IMAGE_PREFIX }}/base-system:latest
160174
175+
- name: Make package public
176+
run: |
177+
gh api --method PUT /orgs/${{ github.repository_owner }}/packages/container/devcontainers%2F${{ matrix.image }}/visibility \
178+
-f visibility=public || true
179+
env:
180+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181+
161182
build-infra-rust:
162183
if: github.event_name == 'push' || inputs.layer == 'all' || inputs.layer == 'infra'
163184
needs: build-intermediate
@@ -209,6 +230,13 @@ jobs:
209230
build-contexts: |
210231
rust:latest=docker-image://${{ env.IMAGE_PREFIX }}/rust:latest
211232
233+
- name: Make package public
234+
run: |
235+
gh api --method PUT /orgs/${{ github.repository_owner }}/packages/container/devcontainers%2F${{ matrix.image }}/visibility \
236+
-f visibility=public || true
237+
env:
238+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
239+
212240
build-infra-go:
213241
if: github.event_name == 'push' || inputs.layer == 'all' || inputs.layer == 'infra'
214242
needs: build-intermediate
@@ -249,3 +277,10 @@ jobs:
249277
cache-to: type=gha,mode=max,scope=${{ matrix.image }}
250278
build-contexts: |
251279
go:latest=docker-image://${{ env.IMAGE_PREFIX }}/go:latest
280+
281+
- name: Make package public
282+
run: |
283+
gh api --method PUT /orgs/${{ github.repository_owner }}/packages/container/devcontainers%2F${{ matrix.image }}/visibility \
284+
-f visibility=public || true
285+
env:
286+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)