-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
}); |