Update PR release workflow

This commit is contained in:
Max Isom 2024-08-17 20:42:08 -07:00
parent e494287d1d
commit 6d6fc4c09d
No known key found for this signature in database

View file

@ -19,15 +19,18 @@ jobs:
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: /tmp/images path: /tmp/images
pattern: image-* pattern: image-linux-*
merge-multiple: true merge-multiple: true
run-id: ${{ github.event.workflow_run.id }} run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.WORKFLOW_PAT }} github-token: ${{ secrets.GH_PAT }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v1
- name: Load image - name: Load image
run: | run: |
docker load --input /tmp/images/image-amd64.tar docker load --input /tmp/images/image-linux-amd64.tar
docker load --input /tmp/images/image-arm64.tar docker load --input /tmp/images/image-linux-arm64.tar
- name: Download PR number - name: Download PR number
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@ -35,7 +38,7 @@ jobs:
path: /tmp/pull_request_number path: /tmp/pull_request_number
pattern: pull_request_number pattern: pull_request_number
run-id: ${{ github.event.workflow_run.id }} run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.WORKFLOW_PAT }} github-token: ${{ secrets.GH_PAT }}
- name: Read the pull_request_number.txt file - name: Read the pull_request_number.txt file
id: pull_request_number_reader id: pull_request_number_reader
@ -43,15 +46,6 @@ jobs:
with: with:
path: ./pull_request_number/pull_request_number.txt path: ./pull_request_number/pull_request_number.txt
- name: Set up Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
@ -59,9 +53,18 @@ jobs:
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Push - name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Create manifest list and push
working-directory: /tmp/digests working-directory: /tmp/digests
run: docker buildx imagetools create -t 'ghcr.io/museofficial/muse:pr-${{ github.event.number }}' -t 'ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}' 'ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}-arm64' 'ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}-amd64' run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Create comment - name: Create comment
uses: marocchino/sticky-pull-request-comment@v2 uses: marocchino/sticky-pull-request-comment@v2
@ -69,7 +72,7 @@ jobs:
header: "pr-release" header: "pr-release"
number: ${{ steps.pull_request_number_reader.outputs.content }} number: ${{ steps.pull_request_number_reader.outputs.content }}
message: | message: |
#### :package: A new release has been made for this pull request. #### :package: :robot: A new release has been made for this pull request.
To play around with this PR, pull `ghcr.io/museofficial/muse:pr-${{ github.event.number }}` or `ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}`. To play around with this PR, pull `ghcr.io/museofficial/muse:pr-${{ github.event.number }}` or `ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}`.