Skip to content

Commit 482e917

Browse files
committed
Add js release and re-estructure into a same workflow call that to run when a Github release is published
1 parent 74cdc76 commit 482e917

File tree

5 files changed

+75
-36
lines changed

5 files changed

+75
-36
lines changed

.github/workflows/javascript.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
name: JavaScript Tests
32

43
on:

.github/workflows/python.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
name: Python Tests
32

43
on:

.github/workflows/release.yml

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,9 @@
1-
---
2-
name: Release
3-
4-
on: push
1+
on:
2+
release:
3+
types: [published]
54

65
jobs:
7-
pypi:
8-
name: Build and publish package to PyPI
9-
runs-on: ubuntu-latest
10-
if: startsWith(github.event.ref, 'refs/tags')
11-
steps:
12-
- uses: actions/checkout@v4
13-
14-
- name: Set up Python
15-
uses: actions/setup-python@v5
16-
with:
17-
python-version: '3.12'
18-
19-
- name: Generate grammar
20-
run: |
21-
python -m pip install -r requirements.txt
22-
poe generate
23-
24-
- name: Build package
25-
run: |
26-
python -m pip install build twine
27-
cd cratedb_sqlparse_py
28-
python -m build
29-
twine check dist/{*.tar.gz,*.whl}
30-
31-
- name: Publish package to PyPI
32-
uses: pypa/gh-action-pypi-publish@release/v1
33-
with:
34-
packages-dir: cratedb_sqlparse_py/dist/
35-
user: __token__
36-
password: ${{ secrets.PYPI_API_TOKEN }}
6+
release_javascript:
7+
uses: ./.github/workflows/release_javascript.yml
8+
release_python:
9+
uses: ./.github/workflows/release_python.yml
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish Package to npmjs
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
id-token: write
12+
steps:
13+
- uses: actions/checkout@v4
14+
# Setup .npmrc file to publish to npm
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: '20.x'
18+
registry-url: 'https://registry.npmjs.org'
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.12'
24+
25+
- name: Generate grammar
26+
run: |
27+
python -m pip install -r requirements.txt
28+
python setup_grammar.py javascript
29+
30+
- run: npm build
31+
- run: npm publish --provenance --access public
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish python parser to pypi
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
name: Build and publish package to PyPI
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.12'
17+
18+
- name: Generate grammar
19+
run: |
20+
python -m pip install -r requirements.txt
21+
python setup_grammar.py python
22+
23+
- name: Build package
24+
run: |
25+
python -m pip install build twine
26+
cd cratedb_sqlparse_py
27+
python -m build
28+
twine check dist/{*.tar.gz,*.whl}
29+
30+
- name: Publish package to PyPI
31+
uses: pypa/gh-action-pypi-publish@release/v1
32+
with:
33+
packages-dir: cratedb_sqlparse_py/dist/
34+
user: __token__
35+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)