-
Notifications
You must be signed in to change notification settings - Fork 17
56 lines (54 loc) · 1.88 KB
/
release-apiv2-client.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
name: Release AirOne APIv2 client npm package to GitHub npm Registry
on:
# use pull_request_target with labeled(repo owner's operation) to prevent leaking secrets
# see also https://pankona.github.io/blog/2021/03/29/github-actions-pull-request-target/
pull_request_target:
types: [labeled]
paths:
- '**/api_v2/**/*.py'
- 'apiclient/typescript-fetch/package.json'
- '.github/workflows/release-apiv2-client.yml'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
if: ${{ github.event.label.name == 'release-apiv2-client' }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: apt-get
run: |
sudo apt-get update
sudo apt-get install libldap2-dev libsasl2-dev libxmlsec1-dev libmysqlclient-dev pkg-config
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: venv
run: |
python3 -m venv virtualenv
source virtualenv/bin/activate
pip install pip --upgrade
pip install poetry
poetry install
# NOTE why is it needed? if missing, spectacular fails because of "no module named custom_view.api_v2"
- name: dummy custom_view
run: |
mkdir -p custom_view/api_v2
echo "urlpatterns = []" > custom_view/api_v2/urls.py
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
scope: '@dmm-com'
- name: generate client
run: |
npm ci
npm run generate:client:new
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
working-directory: ./apiclient/typescript-fetch