Skip to content

Commit fcc1afb

Browse files
committed
build: reenable publish job in workflow
1 parent dbf19be commit fcc1afb

File tree

4 files changed

+88
-86
lines changed

4 files changed

+88
-86
lines changed

.github/workflows/build-test-package-publish.yml

Lines changed: 69 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -171,85 +171,72 @@ jobs:
171171
name: wheel-package
172172
path: dist/*.whl
173173

174-
# publish:
175-
# runs-on: ubuntu-latest
176-
# needs: package
177-
# if: success() && startsWith( github.ref, 'refs/tags/v')
178-
# steps:
179-
# - uses: actions/checkout@v3
180-
# with:
181-
# fetch-depth: 0
182-
183-
# - run: git describe --tag
184-
185-
# - name: setup python environment
186-
# id: setup-python
187-
# uses: actions/setup-python@v4
188-
# with:
189-
# python-version: "3.8"
190-
191-
# - name: install Poetry
192-
# uses: snok/install-poetry@v1
193-
# with:
194-
# virtualenvs-create: true
195-
# virtualenvs-in-project: true
196-
197-
# - name: Load cached venv
198-
# id: cached-poetry-dependencies
199-
# uses: actions/cache@v3
200-
# with:
201-
# path: .venv
202-
# key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
203-
204-
# - name: Install dependencies
205-
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
206-
# run: poetry install --no-interaction --no-root
207-
208-
# - name: install robotcode
209-
# run: poetry install --no-interaction
210-
211-
# - name: Setup Node.js environment
212-
# uses: actions/setup-node@v3
213-
# with:
214-
# node-version: "16"
215-
# cache: "npm"
216-
# cache-dependency-path: package-lock.json
217-
218-
# - name: install node modules
219-
# run: npm install --also=dev
220-
221-
# - uses: actions/download-artifact@v3
222-
# with:
223-
# name: vscode-package
224-
# path: dist
225-
# - uses: actions/download-artifact@v3
226-
# with:
227-
# name: python-package
228-
# path: dist
229-
# - uses: actions/download-artifact@v3
230-
# with:
231-
# name: wheel-package
232-
# path: dist
233-
234-
# - name: get release informations
235-
# id: get_release_informations
236-
# run: |
237-
# poetry run npm run --silent extract-release-notes > ./auto_relnotes.md
238-
239-
# echo "is_prelease=$(poetry run npm run --silent is-prerelease)" >> $GITHUB_OUTPUT
240-
241-
# - name: create github release
242-
# uses: ncipollo/release-action@v1
243-
# with:
244-
# artifacts: "dist/*"
245-
# prerelease: ${{ steps.get_release_informations.outputs.is_prelease }}
246-
# bodyFile: ./auto_relnotes.md
247-
# token: ${{ secrets.GITHUB_TOKEN }}
248-
249-
# - name: publish vsix and python packages
250-
# run: poetry run npm run publish
251-
# env:
252-
# VSCE_PAT: ${{ secrets.VSCE_PAT }}
253-
# OVSX_PAT: ${{ secrets.OVSX_PAT }}
254-
# PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
255-
# PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
174+
publish:
175+
runs-on: ubuntu-latest
176+
needs: package
177+
if: success() && startsWith( github.ref, 'refs/tags/v')
178+
steps:
179+
- uses: actions/checkout@v3
180+
with:
181+
fetch-depth: 0
182+
183+
- run: git describe --tag
184+
185+
- name: setup python environment
186+
id: setup-python
187+
uses: actions/setup-python@v4
188+
with:
189+
python-version: "3.8"
190+
191+
- name: Ensure latest pip is installed
192+
run: python -m pip install --upgrade pip
193+
194+
- name: Ensure latest hatch is installed
195+
run: python -m pip install --upgrade hatch
196+
run: hatch env create build
197+
198+
- name: Setup Node.js environment
199+
uses: actions/setup-node@v3
200+
with:
201+
node-version: "16"
202+
cache: "npm"
203+
cache-dependency-path: package-lock.json
204+
205+
- name: install node modules
206+
run: npm install --also=dev
207+
208+
- uses: actions/download-artifact@v3
209+
with:
210+
name: vscode-package
211+
path: dist
212+
- uses: actions/download-artifact@v3
213+
with:
214+
name: python-package
215+
path: dist
216+
- uses: actions/download-artifact@v3
217+
with:
218+
name: wheel-package
219+
path: dist
220+
221+
- name: get release informations
222+
id: get_release_informations
223+
run: |
224+
hatch -q run build:extract-release-notes > ./auto_relnotes.md
225+
226+
echo "is_prelease=$(hatch -q run build:is-prerelease)" >> $GITHUB_OUTPUT
227+
228+
- name: create github release
229+
uses: ncipollo/release-action@v1
230+
with:
231+
artifacts: "dist/*"
232+
prerelease: ${{ steps.get_release_informations.outputs.is_prelease }}
233+
bodyFile: ./auto_relnotes.md
234+
token: ${{ secrets.GITHUB_TOKEN }}
235+
236+
- name: publish vsix and python packages
237+
run: hatch -q run build:publish
238+
env:
239+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
240+
OVSX_PAT: ${{ secrets.OVSX_PAT }}
241+
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
242+
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

scripts/extract_release_notes.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1+
import contextlib
12
import re
3+
import sys
24
from pathlib import Path
35

6+
if __name__ == "__main__" and __package__ is None or __package__ == "":
7+
file = Path(__file__).resolve()
8+
parent, top = file.parent, file.parents[1]
9+
10+
if str(top) not in sys.path:
11+
sys.path.append(str(top))
12+
13+
with contextlib.suppress(ValueError):
14+
sys.path.remove(str(parent))
15+
16+
__package__ = "scripts"
17+
18+
419
from scripts.tools import get_version
520

621

scripts/package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def main() -> None:
2424
if not dist_path.exists():
2525
dist_path.mkdir()
2626

27+
run("hatch -e build build", shell=True).check_returncode()
28+
2729
run(
2830
f"npx vsce package {'--pre-release' if get_version().prerelease else ''} -o ./dist", shell=True
2931
).check_returncode()
3032

31-
run("hatch -e build build", shell=True).check_returncode()
32-
3333

3434
if __name__ == "__main__":
3535
main()

scripts/publish.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def main() -> None:
3131
run("npx vsce publish", f"npx vsce publish -i {vsix_path}", shell=True, timeout=600)
3232
run("npx ovsx publish", f"npx ovsx publish {vsix_path}", shell=True, timeout=600)
3333
run(
34-
"poetry publish",
35-
f"poetry publish --username {os.environ['PYPI_USERNAME']} --password {os.environ['PYPI_PASSWORD']}",
34+
"hatch publish",
35+
f'hatch -e build publish -u "{os.environ["PYPI_USERNAME"]}" -a "{os.environ["PYPI_PASSWORD"]}"',
3636
shell=True,
3737
timeout=600,
3838
)

0 commit comments

Comments
 (0)