Skip to content

Commit 78a07c3

Browse files
committed
test new action
1 parent dfdacbe commit 78a07c3

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

.github/workflows/publish_container.yaml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
22
name: Create and publish a Docker image
33

4-
# Configures this workflow to run every time a change is pushed to the branch called `release`.
54
on:
65
release:
76
types: [published]
@@ -44,6 +43,25 @@ jobs:
4443
tags: |
4544
type=ref,event=branch
4645
type=sha,format=long
46+
- name: Get Release ID
47+
id: get_release
48+
run: |
49+
RELEASE_RESPONSE=$(curl \
50+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
51+
-H "Accept: application/vnd.github+json" \
52+
https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }})
53+
echo "RELEASE_ID=$(echo "$RELEASE_RESPONSE" | jq .id)" >> $GITHUB_ENV
54+
55+
- name: Update Release Body
56+
if: env.RELEASE_ID != ''
57+
run: |
58+
curl -X PATCH \
59+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
60+
-H "Accept: application/vnd.github+json" \
61+
-d "{\"body\": \"Docker Image Tag: ${{ steps.meta.outputs.tags }}\n```\ndocker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}\n```\nVerify the contents of the image:\n```\ngh attestation verify oci://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} --owner ${{ github.actor }}\n```\"}" \
62+
https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4765
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
4866
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
4967
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
@@ -71,24 +89,4 @@ jobs:
7189
with:
7290
sbom: sbom-image-latest.json
7391
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
74-
subject-digest: ${{ steps.build-push-latest.outputs.digest }}
75-
- name: Create or Update GitHub Release
76-
uses: softprops/action-gh-release@v1
77-
with:
78-
# Set the tag name and release name
79-
tag_name: ${{ github.ref }}
80-
release_name: Release ${{ github.ref }}
81-
# Add information about the Docker image to the release notes
82-
body: |
83-
Docker Image Tag: ${{ steps.meta.outputs.tags }}
84-
```
85-
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}
86-
```
87-
Verify the contents of the image:
88-
```
89-
gh attestation verify oci://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }} --owner ${{ github.actor }}
90-
```
91-
# Set the release to draft if you want to manually review it before publishing
92-
# draft: true
93-
env:
94-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
subject-digest: ${{ steps.build-push-latest.outputs.digest }}

0 commit comments

Comments
 (0)