Repository navigation
97 lines (81 loc) · 2.45 KB
/
Copy pathmain.yml
File metadata and controls
97 lines (81 loc) · 2.45 KB
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
name: publish packages
permissions:
contents: read
on:
push:
branches: [main]
paths:
- "js/**"
- "py/**"
workflow_dispatch:
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
js_changed: ${{ steps.filter.outputs.js }}
py_changed: ${{ steps.filter.outputs.py }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
js:
- "js/**"
py:
- "py/**"
publish-js:
needs: detect-changes
runs-on: ubuntu-latest
if: needs.detect-changes.outputs.js_changed == 'true' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
- name: get version
id: version
run: |
cd js
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing secuprompt@$VERSION"
- name: install deps
run: cd js && npm ci
- name: build
run: cd js && npm run build
- name: publish
run: cd js && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: notify
run: |
echo "✅ Published secuprompt@${{ steps.version.outputs.version }}"
publish-py:
needs: detect-changes
runs-on: ubuntu-latest
if: needs.detect-changes.outputs.py_changed == 'true' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: get version
id: version
run: |
VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing secuprompt@$VERSION"
- name: install build tools
run: pip install build twine
- name: build
run: python -m build --outdir pydist
- name: publish
run: python -m twine upload pydist/* --skip-existing
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: notify
run: |
echo "✅ Published secuprompt@${{ steps.version.outputs.version }}"