Skip to content

Commit 83691a3

Browse files
chore: central update of publish.yml
1 parent 1d09808 commit 83691a3

1 file changed

Lines changed: 22 additions & 173 deletions

File tree

.github/workflows/publish.yml

Lines changed: 22 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,180 +1,29 @@
1-
name: publish
1+
# Generated automatically by org-governance-bot. Do not edit manually.
2+
name: "publish"
23

34
on:
45
push:
5-
branches: ['main']
6+
branches:
7+
- main
68
tags:
7-
- 'v*.*.*'
9+
- v*.*.*
810

9-
concurrency: ${{ github.ref }}
11+
permissions:
12+
actions: write
13+
attestations: write
14+
checks: write
15+
contents: write
16+
id-token: write
17+
packages: write
18+
statuses: write
1019

1120
jobs:
12-
create-draft-release:
13-
runs-on: ubuntu-latest
14-
permissions:
15-
contents: write
16-
outputs:
17-
RELEASE_ID: ${{ steps.create-release.outputs.result }}
18-
steps:
19-
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
20-
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 https://github.com/actions/github-script/releases/tag/v9
21-
id: create-release
22-
if: startsWith(github.ref, 'refs/tags/')
23-
with:
24-
github-token: ${{ secrets.GITHUB_TOKEN }}
25-
result-encoding: string
26-
script: |
27-
try {
28-
const response = await github.rest.repos.createRelease({
29-
draft: true,
30-
generate_release_notes: true,
31-
name: process.env.RELEASE_TAG,
32-
owner: context.repo.owner,
33-
prerelease: false,
34-
repo: context.repo.repo,
35-
tag_name: process.env.RELEASE_TAG,
36-
});
37-
38-
return response.data.id;
39-
} catch (error) {
40-
core.setFailed(error.message);
41-
}
42-
43-
build-binaries:
44-
strategy:
45-
matrix:
46-
os: [linux, darwin, freebsd, windows]
47-
arch: [amd64, arm64]
48-
runs-on: ubuntu-latest
49-
needs: [create-draft-release]
50-
permissions:
51-
actions: write
52-
attestations: write
53-
checks: write
54-
contents: write
55-
id-token: write
56-
packages: write
57-
statuses: write
58-
steps:
59-
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
60-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 https://github.com/actions/checkout/releases/tag/v6.0.3
61-
with:
62-
fetch-depth: '0'
63-
persist-credentials: false
64-
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 https://github.com/actions/setup-go/releases/tag/v6
65-
with:
66-
go-version: 1.26.x
67-
- name: Build binary
68-
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} make build
69-
- name: Upload release asset
70-
if: startsWith(github.ref, 'refs/tags/')
71-
run: |
72-
_filename=txtop-${{ env.RELEASE_TAG }}-${{ matrix.os }}-${{ matrix.arch }}
73-
if [[ ${{ matrix.os }} == windows ]]; then
74-
_filename=${_filename}.exe
75-
fi
76-
cp txtop ${_filename}
77-
curl \
78-
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
79-
-H "Content-Type: application/octet-stream" \
80-
--data-binary @${_filename} \
81-
https://uploads.github.com/repos/${{ github.repository_owner }}/txtop/releases/${{ needs.create-draft-release.outputs.RELEASE_ID }}/assets?name=${_filename}
82-
- name: Attest binary
83-
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0 https://github.com/actions/attest/releases/tag/v4.1.0
84-
with:
85-
subject-path: 'txtop'
86-
87-
build-images:
88-
runs-on: ubuntu-latest
89-
needs: [create-draft-release]
90-
permissions:
91-
actions: write
92-
attestations: write
93-
checks: write
94-
contents: write
95-
id-token: write
96-
packages: write
97-
statuses: write
98-
steps:
99-
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
100-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 https://github.com/actions/checkout/releases/tag/v6.0.3
101-
with:
102-
fetch-depth: '0'
103-
persist-credentials: false
104-
- name: Set up QEMU
105-
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4 https://github.com/docker/setup-qemu-action/releases/tag/v4
106-
- name: Set up Docker Buildx
107-
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4 https://github.com/docker/setup-buildx-action/releases/tag/v4
108-
- name: Login to Docker Hub
109-
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4 https://github.com/docker/login-action/releases/tag/v4
110-
with:
111-
username: blinklabs
112-
password: ${{ secrets.DOCKER_PASSWORD }} # uses token
113-
- name: Login to GHCR
114-
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4 https://github.com/docker/login-action/releases/tag/v4
115-
with:
116-
username: ${{ github.repository_owner }}
117-
password: ${{ secrets.GITHUB_TOKEN }}
118-
registry: ghcr.io
119-
- id: meta
120-
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6 https://github.com/docker/metadata-action/releases/tag/v6
121-
with:
122-
images: |
123-
blinklabs/txtop
124-
ghcr.io/${{ github.repository }}
125-
tags: |
126-
# branch
127-
type=ref,event=branch
128-
# semver
129-
type=semver,pattern={{version}}
130-
- name: Build images
131-
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7 https://github.com/docker/build-push-action/releases/tag/v7
132-
id: push
133-
with:
134-
outputs: "type=registry,push=true"
135-
platforms: linux/amd64,linux/arm64
136-
tags: ${{ steps.meta.outputs.tags }}
137-
labels: ${{ steps.meta.outputs.labels }}
138-
- name: Attest Docker Hub image
139-
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0 https://github.com/actions/attest/releases/tag/v4.1.0
140-
with:
141-
subject-name: index.docker.io/blinklabs/txtop
142-
subject-digest: ${{ steps.push.outputs.digest }}
143-
push-to-registry: true
144-
- name: Attest GHCR image
145-
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0 https://github.com/actions/attest/releases/tag/v4.1.0
146-
with:
147-
subject-name: ghcr.io/${{ github.repository }}
148-
subject-digest: ${{ steps.push.outputs.digest }}
149-
push-to-registry: true
150-
# Update Docker Hub from README
151-
- name: Docker Hub Description
152-
uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5 https://github.com/peter-evans/dockerhub-description/releases/tag/v5
153-
with:
154-
username: blinklabs
155-
password: ${{ secrets.DOCKER_PASSWORD }}
156-
repository: blinklabs/txtop
157-
readme-filepath: ./README.md
158-
short-description: "txtop is a mempool display tool for a Cardano Node"
159-
160-
finalize-release:
161-
runs-on: ubuntu-latest
162-
permissions:
163-
contents: write
164-
needs: [create-draft-release, build-binaries, build-images]
165-
steps:
166-
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 https://github.com/actions/github-script/releases/tag/v9
167-
if: startsWith(github.ref, 'refs/tags/')
168-
with:
169-
github-token: ${{ secrets.GITHUB_TOKEN }}
170-
script: |
171-
try {
172-
await github.rest.repos.updateRelease({
173-
owner: context.repo.owner,
174-
repo: context.repo.repo,
175-
release_id: ${{ needs.create-draft-release.outputs.RELEASE_ID }},
176-
draft: false,
177-
});
178-
} catch (error) {
179-
core.setFailed(error.message);
180-
}
21+
orchestrate:
22+
uses: blinklabs-io/actions/.github/workflows/reuseable-publish.yml@main
23+
secrets:
24+
docker-password: ${{ secrets.DOCKER_PASSWORD }}
25+
with:
26+
binary-name: txtop
27+
description: txtop is a mempool display tool for a Cardano Node
28+
docker-image: blinklabs/txtop
29+
go-version: 1.26.x

0 commit comments

Comments
 (0)