Skip to content

Commit 10ddab4

Browse files
committed
Add step to make Docker package public in GitHub Actions workflow after build completion
1 parent f1e62de commit 10ddab4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ jobs:
8787
cache-from: type=gha
8888
cache-to: type=gha,mode=max
8989

90+
- name: Make package public
91+
if: github.event_name != 'pull_request'
92+
run: |
93+
# Wait a moment for the package to be fully created
94+
sleep 10
95+
96+
# Get package info and make it public
97+
PACKAGE_NAME=$(echo "${{ env.IMAGE_NAME_LOWER }}" | cut -d'/' -f2)
98+
99+
curl -X PATCH \
100+
-H "Accept: application/vnd.github+json" \
101+
-H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \
102+
-H "X-GitHub-Api-Version: 2022-11-28" \
103+
https://api.github.com/user/packages/container/${PACKAGE_NAME} \
104+
-d '{"visibility":"public"}' || echo "Package may already be public or error occurred"
105+
90106
- name: Create release archives
91107
if: github.event_name == 'release'
92108
run: |

0 commit comments

Comments
 (0)