-
Notifications
You must be signed in to change notification settings - Fork 3
102 lines (89 loc) · 2.71 KB
/
build.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
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
name: Build
on:
push:
branches: main
pull_request:
branches: '*'
workflow_dispatch:
inputs:
publish-release:
description: "Publish Release"
required: false
type: boolean
default: false
production-release:
description: "Production Release"
required: false
type: boolean
default: false
increment-version:
description: "Increment Version"
required: false
type: choice
options:
- none
- patch
- minor
- major
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: |
python -m pip install -U "jupyterlab>=4.0.0,<5"
python -m pip install -U "build"
python -m pip install -I "hatch"
- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
- name: Test the extension
run: |
set -eux
jlpm run test
- name: Increment the Version
id: version
if: ${{ inputs.increment-version && inputs.increment-version != 'none' }}
run: |
hatch version ${{ inputs.increment-version }}
echo "VERSION_NAME=$(hatch version)" >> $GITHUB_OUTPUT
# Commit all changed files back to the repository
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Increment Version
tagging_message: ${{ steps.version.outputs.VERSION_NAME }}
- name: Build the extension
run: |
set -eux
jlpm
jlpm clean:all
git clean -dfX
sed -i 's/"@quarto\/jupyterlab-quarto"/"jupyterlab-quarto"/g' package.json
python -m build
sed -i 's/"jupyterlab-quarto"/"@quarto\/jupyterlab-quarto"/g' package.json
jlpm
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ inputs.publish-release && ! inputs.production-release }}
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ inputs.publish-release && inputs.production-release }}
- name: Build the NPM Front End
run: |
jlpm clean:all && git clean -dfX
jlpm && jlpm build:prod
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
if: ${{ inputs.publish-release && inputs.production-release }}