Skip to content

Commit

Permalink
Add draft version
Browse files Browse the repository at this point in the history
  • Loading branch information
fabergat committed Jan 22, 2025
1 parent 84541ed commit adebf67
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/docker_release_link.yaml
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 }}
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
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
}
});

0 comments on commit adebf67

Please sign in to comment.