Skip to content

test(ledger): increase sleep timer for fail check (#1086) #873

test(ledger): increase sleep timer for fail check (#1086)

test(ledger): increase sleep timer for fail check (#1086) #873

Workflow file for this run

name: publish
on:
push:
branches: ['main']
tags:
- 'v*.*.*'
concurrency: ${{ github.ref }}
env:
APPLICATION_NAME: 'dingo'
jobs:
create-draft-release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
RELEASE_ID: ${{ steps.create-release.outputs.result }}
steps:
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script/releases/tag/v8.0.0
id: create-release
if: startsWith(github.ref, 'refs/tags/')
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
try {
const response = await github.rest.repos.createRelease({
draft: true,
generate_release_notes: true,
name: process.env.RELEASE_TAG,
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: process.env.RELEASE_TAG,
});
return response.data.id;
} catch (error) {
core.setFailed(error.message);
}
build-binaries:
strategy:
matrix:
include:
- runner: macos-latest
os: darwin
arch: arm64
- runner: ubuntu-latest
os: freebsd
arch: amd64
- runner: ubuntu-latest
os: freebsd
arch: arm64
- runner: ubuntu-latest
os: linux
arch: amd64
- runner: ubuntu-latest
os: linux
arch: arm64
runs-on: ${{ matrix.runner }}
needs: [create-draft-release]
permissions:
actions: write
attestations: write
checks: write
contents: write
id-token: write
packages: write
statuses: write
steps:
- name: Set RELEASE_TAG
run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
- run: git config --global --add safe.directory $PWD
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 https://github.com/actions/checkout/releases/tag/v6.0.0
with:
fetch-depth: 0
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 https://github.com/actions/setup-go/releases/tag/v6.1.0
with:
go-version: 1.24.x
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 https://github.com/actions/cache/releases/tag/v4.3.0
with:
path: |
~/go/pkg/mod
${{ runner.os == 'macOS' && '~/Library/Caches/go-build' || '~/.cache/go-build' }}
key: ${{ runner.os }}-go-1.24.x-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-1.24.x-
- name: Build binary
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} make build
- name: Upload release asset
if: startsWith(github.ref, 'refs/tags/')
run: |
_filename=${{ env.APPLICATION_NAME }}-${{ env.RELEASE_TAG }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
tar czf ${_filename} ${{ env.APPLICATION_NAME }}
curl \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @${_filename} \
https://uploads.github.com/repos/${{ github.repository_owner }}/${{ env.APPLICATION_NAME }}/releases/${{ needs.create-draft-release.outputs.RELEASE_ID }}/assets?name=${_filename}
- name: Attest binary
if: startsWith(github.ref, 'refs/tags/')
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0 https://github.com/actions/attest-build-provenance/releases/tag/v3.0.0
with:
subject-path: '${{ env.APPLICATION_NAME }}'
build-images:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: amd64
- os: ubuntu-24.04-arm
arch: arm64
runs-on: ${{ matrix.os }}
needs: [create-draft-release]
permissions:
actions: write
attestations: write
checks: write
contents: write
id-token: write
packages: write
statuses: write
steps:
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
- run: git config --global --add safe.directory $PWD
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 https://github.com/actions/checkout/releases/tag/v6.0.0
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 https://github.com/docker/setup-buildx-action/releases/tag/v3.11.1
- name: Login to Docker Hub
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 https://github.com/docker/login-action/releases/tag/v3.4.0
with:
username: blinklabs
password: ${{ secrets.DOCKER_PASSWORD }} # uses token
- name: Login to GHCR
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 https://github.com/docker/login-action/releases/tag/v3.4.0
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
- id: meta
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0 https://github.com/docker/metadata-action/releases/tag/v5.7.0
with:
images: |
blinklabs/dingo
ghcr.io/${{ github.repository }}
flavor: |
latest=false
suffix=-${{ matrix.arch }}
tags: |
# Only version, no revision
type=match,pattern=v(.*)-(.*),group=1
# branch
type=ref,event=branch
# semver
type=semver,pattern={{version}}
- name: Build images
id: push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 https://github.com/docker/build-push-action/releases/tag/v6.18.0
with:
outputs: "type=registry,push=true"
platforms: linux/${{ matrix.arch }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ github.ref_type == 'tag' && github.ref_name || '' }}
COMMIT_HASH=${{ github.sha }}
- name: Attest Docker Hub image
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0 https://github.com/actions/attest-build-provenance/releases/tag/v3.0.0
with:
subject-name: index.docker.io/blinklabs/dingo
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
- name: Attest GHCR image
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0 https://github.com/actions/attest-build-provenance/releases/tag/v3.0.0
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
build-image-manifest:
needs: [build-images]
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: blinklabs
password: ${{ secrets.DOCKER_PASSWORD }} # uses token
- name: Login to GHCR
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
- id: meta
uses: docker/metadata-action@v5
with:
images: |
blinklabs/dingo
ghcr.io/${{ github.repository }}
flavor: |
latest=false
tags: |
# Only version, no revision
type=match,pattern=v(.*)-(.*),group=1
# branch
type=ref,event=branch
# semver
type=semver,pattern={{version}}
- name: manifest-create
shell: bash
run: |
for t in `echo '${{ steps.meta.outputs.tags }}'`; do
# Extract the underlying manifests from each manifests list and create a new single manifest list
docker manifest create ${t} \
$(docker manifest inspect ${t}-amd64 | jq -r '.manifests[] | .digest' | sed -e "s|^|${t%:*}@|") \
$(docker manifest inspect ${t}-arm64 | jq -r '.manifests[] | .digest' | sed -e "s|^|${t%:*}@|")
docker manifest push ${t}
done
# Checkout repo so README.md is available for next step
- uses: actions/checkout@v6
# Update Docker Hub from README
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5.0.0 https://github.com/peter-evans/dockerhub-description/releases/tag/v5.0.0
with:
username: blinklabs
password: ${{ secrets.DOCKER_PASSWORD }}
repository: blinklabs/${{ env.APPLICATION_NAME }}
readme-filepath: ./README.md
short-description: "Dingo is a Cardano blockchain data node"
finalize-release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [create-draft-release, build-binaries, build-images, build-image-manifest]
steps:
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script/releases/tag/v8.0.0
if: startsWith(github.ref, 'refs/tags/')
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ needs.create-draft-release.outputs.RELEASE_ID }},
draft: false,
});
} catch (error) {
core.setFailed(error.message);
}
# This updates the documentation on pkg.go.dev and the latest version available via the Go module proxy
- name: Pull new module version
if: startsWith(github.ref, 'refs/tags/')
uses: andrewslotin/go-proxy-pull-action@0ef95ea50ab6c03f2f095a5102bbdecad8fd7602 # v1.3.0 https://github.com/andrewslotin/go-proxy-pull-action/releases/tag/v1.3.0
npm-release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
needs: [finalize-release]
steps:
- run: |
RELEASE_TAG=${GITHUB_REF#refs/tags/}
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
echo "RELEASE_VERSION=${RELEASE_TAG:1}" >> $GITHUB_ENV
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 https://github.com/actions/checkout/releases/tag/v6.0.0
if: startsWith(github.ref, 'refs/tags/')
- name: setup nodejs
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 https://github.com/actions/setup-node/releases/tag/v6.0.0
if: startsWith(github.ref, 'refs/tags/')
with:
node-version: '23.x'
registry-url: 'https://registry.npmjs.org'
- name: Update package.json
run: sed -e "s/0.999.0/${RELEASE_VERSION}/" .github/package.json > package.json
if: startsWith(github.ref, 'refs/tags/')
- name: Publish to NPM
run: npm publish --provenance --access public
if: startsWith(github.ref, 'refs/tags/')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}