Skip to content

Commit

Permalink
Refactor release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fabergat committed Jan 23, 2025
1 parent ff763f8 commit a4f19b3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 65 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/docker_release_link.yaml

This file was deleted.

51 changes: 39 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Schedule the docker link workflow
name: Release workflow - Add the docker hub link to the release notes

on:
release:
Expand All @@ -8,26 +8,53 @@ on:
permissions:
actions: write
contents: read
issues: write

jobs:
trigger-delayed:
name: Trigger Delayed Workflow
manual-approval:
name: Waiting for manual approval
runs-on: ubuntu-latest

steps:
- name: Wait for manual approval
uses: trstringer/manual-approval@662b3ddbc7685f897992051e87e1b4b58c07dc03 #v1.9.1
with:
secret: ${{ github.TOKEN }}
approvers: fabergat, aldur, matteojug, djordon
minimum-approvals: 1
issue-title: "Add Docker Hub link to the ${{ github.event.release.tag_name }} release notes"
issue-body: "Please approve or deny the ${{ github.ref_name }}. Wait the Build and Release sBTC Signer ${{ github.event.release.tag_name }} Docker Image workflow finish with a success."
exclude-workflow-initiator-as-approver: false

update-release:
name: Update Release Page
permissions: write-all
runs-on: ubuntu-latest
needs: manual-approval

steps:
- name: Trigger Delayed Workflow
- 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.release.tag_name }}
DIGEST=$(curl -s https://hub.docker.com/v2/repositories/$DOCKER_REPO/tags/signer-$TAG | jq -r '.images[0].digest')
echo "link=hub.docker.com/layers/$DOCKER_REPO/signer-$TAG/images/$DIGEST" >> $GITHUB_ENV
- name: Update Release with Docker Image Link
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
with:
script: |
await github.rest.actions.createWorkflowDispatch({
const link = process.env.link;
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'docker_release_link.yaml',
ref: context.ref,
inputs: {
release_id: context.payload.release.id,
release_body: context.payload.release.body,
release_tag: context.payload.release.tag_name
}
release_id: context.payload.release.id,
body: `${context.payload.release.body}\n\n**Release Docker Image:** [https://${link}](https://${link})`
});
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit a4f19b3

Please sign in to comment.