-
Notifications
You must be signed in to change notification settings - Fork 22
153 lines (149 loc) · 5.73 KB
/
build-publish.yaml
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
name: Build & Publish
on:
pull_request:
branches:
- '**'
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
package:
[
'wallet:backend',
'wallet:frontend',
'boutique:backend',
'boutique:frontend'
]
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: v9.1.4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies for ${{ matrix.package }}
shell: bash
run: |
pnpm ${{ matrix.package }} install --frozen-lockfile
- name: Run build
run: |
pnpm ${{ matrix.package }} build
publish:
runs-on: ubuntu-latest
needs: build
timeout-minutes: 15
if: startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
package:
- name: test-wallet-backend
identifier: 'wallet:backend'
path: packages/wallet/backend
- name: test-wallet-frontend
identifier: 'wallet:frontend'
path: packages/wallet/frontend
port: 4003
cookie_name: testnet.cookie
backend_url: https://api.wallet.interledger-test.dev
open_payments_host: $ilp.interledger-test.dev/
auth_host: https://auth.interledger-test.dev
gatehub_env: sandbox
theme: dark
- name: test-wallet-frontend-cards
identifier: 'wallet:frontend'
path: packages/wallet/frontend
port: 4003
cookie_name: interledgercards.cookie
backend_url: https://api.interledger.cards
open_payments_host: $ilp.dev/
auth_host: https://auth.interledger.cards
gatehub_env: production
theme: light
- name: test-boutique-frontend
identifier: 'boutique:frontend'
path: packages/boutique/frontend
api_base_url: 'https://api.boutique.interledger-test.dev'
currency: 'USD'
theme: dark
- name: test-boutique-frontend-jopacc
identifier: 'boutique:frontend'
path: packages/boutique/frontend
api_base_url: 'https://api.boutique.jopacc.openpayments.directory'
currency: 'JOD'
theme: light
- name: test-boutique-backend
identifier: 'boutique:backend'
path: packages/boutique/backend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- 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: Docker build and push
uses: docker/build-push-action@v6
with:
context: ./
push: true
file: ${{ matrix.package.path }}/Dockerfile.prod
build-args: |
${{ matrix.package.identifier == 'boutique:frontend' && format('VITE_API_BASE_URL={0}', matrix.package.api_base_url) || '' }}
${{ matrix.package.identifier == 'boutique:frontend' && format('VITE_CURRENCY={0}', matrix.package.currency) || '' }}
${{ matrix.package.identifier == 'boutique:frontend' && format('VITE_THEME={0}', matrix.package.theme) || '' }}
${{ matrix.package.identifier == 'wallet:frontend' && format('PORT={0}', matrix.package.port) || '' }}
${{ matrix.package.identifier == 'wallet:frontend' && format('COOKIE_NAME={0}', matrix.package.cookie_name) || '' }}
${{ matrix.package.identifier == 'wallet:frontend' && format('NEXT_PUBLIC_BACKEND_URL={0}', matrix.package.backend_url) || '' }}
${{ matrix.package.identifier == 'wallet:frontend' && format('NEXT_PUBLIC_OPEN_PAYMENTS_HOST={0}', matrix.package.open_payments_host) || '' }}
${{ matrix.package.identifier == 'wallet:frontend' && format('NEXT_PUBLIC_AUTH_HOST={0}', matrix.package.auth_host) || '' }}
${{ matrix.package.identifier == 'wallet:frontend' && format('NEXT_PUBLIC_GATEHUB_ENV={0}', matrix.package.gatehub_env) || '' }}
${{ matrix.package.identifier == 'wallet:frontend' && format('NEXT_PUBLIC_THEME={0}', matrix.package.theme) || '' }}
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.package.name }}:${{ github.ref_name }},ghcr.io/${{ github.repository_owner }}/${{ matrix.package.name }}:latest
generate-release:
runs-on: ubuntu-latest
needs: publish
timeout-minutes: 5
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
tag: ${{ github.ref_name }}
token: ${{ github.token }}
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md