forked from anoma/namada-indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (109 loc) · 3.67 KB
/
deploy.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
name: Deploy Stuff 🧙♂️
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-[a-z]+"
branches:
- "v?[0-9]+.[0-9]+.[0-9]+-rc"
- "v?[0-9]+.[0-9]+.[0-9]+-[a-z]+-rc"
permissions:
packages: write
pages: write
id-token: write
contents: read
jobs:
swagger-ui:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Generate Swagger UI
uses: Legion2/swagger-ui-action@v1
with:
output: swagger-ui
spec-file: swagger.yml
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Pages
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/configure-pages@v5
- name: Upload artifact
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-pages-artifact@v3
with:
path: 'swagger-ui'
- name: Deploy to GitHub Pages
if: startsWith(github.ref, 'refs/tags/v')
id: deployment
uses: actions/deploy-pages@v4
docker:
name: Docker
runs-on: ubuntu-latest
env:
GIT_LFS_SKIP_SMUDGE: 1
REGISTRY_URL: ghcr.io
strategy:
fail-fast: true
matrix:
docker:
[
{ image: chain, package: chain },
{ image: governance, package: governance },
{ image: pos, package: pos },
{ image: rewards, package: rewards },
{ image: seeder, package: seeder },
{ image: webserver, package: webserver },
{ image: parameters, package: parameters },
{ image: transactions, package: transactions },
]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- id: get_version
uses: battila7/get-version-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
id: push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
build-args: PACKAGE=${{ matrix.docker.package }}
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ env.REGISTRY_URL }}/anoma/namada-indexer:${{ matrix.docker.image }}-${{ steps.get_version.outputs.version-without-v }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
swagger-npm-package:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- id: get_version
uses: battila7/get-version-action@v2
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Authenticate with private NPM package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Generate openapi client configuration file
run: python3 .github/workflows/scripts/update-package.py ${{ steps.get_version.outputs.version-without-v }}
- name: Generate Typescript Client
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: typescript-axios
openapi-file: swagger.yml
command-args: -c swagger-codegen.json -o client
- name: Publish package
if: startsWith(github.ref, 'refs/tags/v')
run: cd client && npm install && npm run build && npm publish --access public --verbose