diff --git a/.github/workflows/docker_release_link.yaml b/.github/workflows/docker_release_link.yaml new file mode 100644 index 000000000..b7f11c1ff --- /dev/null +++ b/.github/workflows/docker_release_link.yaml @@ -0,0 +1,52 @@ +name: Update Release with Docker Image Link + +on: + workflow_dispatch: + inputs: + release_id: + description: 'Release ID' + required: true + release_body: + description: 'Release body' + required: true + release_tag: + description: 'Release tag' + required: true + +permissions: + contents: write + actions: read + +jobs: + update-release: + name: Update Release Page + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 + + - name: Get Docker Image Digest + id: docker-info + run: | + DOCKER_REPO="blockstack/sbtc" + TAG=${{ github.event.inputs.release_tag }} + DIGEST=$(curl -s https://hub.docker.com/v2/repositories/$DOCKER_REPO/tags/signer-$TAG | jq -r '.images[0].digest') + echo "latest_digest=hub.docker.com/layers/$DOCKER_REPO/$TAG/images/$DIGEST" >> $GITHUB_ENV + + - name: Update Release with Docker Image Link + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1 + with: + script: | + const latestDigest = process.env.latest_digest; + const releaseId = ${github.event.inputs.release_id}; + const octokit = github.getOctokit(process.env.GITHUB_TOKEN); + + await octokit.rest.repos.updateRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: releaseId, + body: `${github.event.inputs.release_body}\n\n**Release Docker Image:** [${latestDigest}](https://${latestDigest})` + }); + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..14a650847 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: Schedule the docker link workflow + +on: + release: + types: + - published + +permissions: + actions: write + contents: read + +jobs: + trigger-delayed: + name: Trigger Delayed Workflow + runs-on: ubuntu-latest + + steps: + - name: Trigger Delayed Workflow + uses: actions/github-script@v11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 + with: + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: 'delayed-update.yml', + ref: context.ref, + inputs: { + release_id: context.payload.release.id, + release_body: context.payload.release.body, + release_tag: context.payload.release.tag_name + } + });