-
Notifications
You must be signed in to change notification settings - Fork 953
159 lines (137 loc) · 4.46 KB
/
ci_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: CI and Release
on:
merge_group:
push:
branches:
- main
tags:
- '**'
release:
types: [published]
pull_request:
workflow_dispatch:
inputs:
run-on-tag:
description: 'Tag for release'
required: true
jobs:
# set up go version for use through pipelines, setting
# variable one time and setting outputs to access passing it
# to other jobs
setup:
runs-on: ubuntu-latest
env:
# upgrade go version throughout pipeline here
GO_VERSION: "1.23"
outputs:
go-version: ${{ steps.set-vars.outputs.go-version }}
branch: ${{ steps.trim_ref.outputs.branch }}
debug: ${{ steps.debug.outputs.debug }}
steps:
- name: Set go version
id: set-vars
run: echo "go-version=${{env.GO_VERSION}}" >> "$GITHUB_OUTPUT"
- name: Trim branch name
id: trim_ref
run: |
echo "branch=$(${${{ github.ref }}:11})" >> $GITHUB_OUTPUT
- name: Set debug output
id: debug
run: |
if [[ "${{ runner.debug }}" == "true" ]]; then
echo "debug=true" >> $GITHUB_ENV
else
echo "debug=false" >> $GITHUB_ENV
fi
# Dockerfile Linting
hadolint:
uses: celestiaorg/.github/.github/workflows/reusable_dockerfile_lint.yml@v0.4.5 # yamllint disable-line rule:line-length
with:
dockerfile: Dockerfile
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: celestiaorg/.github/.github/actions/yamllint@v0.4.5
markdown-lint:
name: Markdown Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: |
npm install -g markdownlint-cli@0.32.1
markdownlint --config .markdownlint.yaml '**/*.md'
go-ci:
needs: setup
uses: ./.github/workflows/go-ci.yml
with:
go-version: ${{ needs.setup.outputs.go-version }}
# Generate the release with goreleaser to include pre-built binaries
goreleaser:
needs: [setup]
runs-on: ubuntu-latest
if: |
github.event_name == 'release' ||
github.event_name == 'workflow_dispatch'
permissions: "write-all"
steps:
- uses: actions/checkout@v4
- run: git fetch --force --tags
- name: Set LATEST_TAG for release
if: github.event_name == 'release'
run: echo "LATEST_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
- name: Set LATEST_TAG for workflow_dispatch
if: github.event_name == 'workflow_dispatch'
run: echo "LATEST_TAG=${{ inputs.run-on-tag }}" >> $GITHUB_ENV
- name: Checkout a given tag
if: github.event_name == 'workflow_dispatch'
run: git checkout ${{ inputs.run-on-tag }}
- uses: actions/setup-go@v5
with:
go-version: ${{ needs.setup.outputs.go-version }}
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
# Generate the binaries and release
- uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GORELEASER_CURRENT_TAG: ${{ env.LATEST_TAG }}
upload-docs:
needs: [setup]
if: |
github.event_name == 'release' ||
github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: git fetch --force --tags
- name: Set LATEST_TAG for release
if: github.event_name == 'release'
run: echo "LATEST_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
- name: Set LATEST_TAG for workflow_dispatch
if: github.event_name == 'workflow_dispatch'
run: echo "LATEST_TAG=${{ inputs.run-on-tag }}" >> $GITHUB_ENV
- name: Checkout a given tag
if: github.event_name == 'workflow_dispatch'
run: git checkout ${{ inputs.run-on-tag }}
- run: |
make openrpc-gen > openrpc.json
gh release upload "$LATEST_TAG" openrpc.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}