Skip to content

Update build.yml

Update build.yml #87

Workflow file for this run

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 }}