This repository has been archived by the owner on Jul 1, 2023. It is now read-only.
chore(deps): update dependency @types/node to v20.3.2 #124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build (and publish)" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
force-publish: | |
type: boolean | |
description: Force the build to publish regardless of version change | |
default: false | |
required: false | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install build dependencies | |
run: python3 -m pip install --upgrade build | |
- name: Install frontend dependencies | |
run: yarn install --frozen-lockfile | |
working-directory: ./osmosis/frontend | |
- name: Build frontend | |
run: yarn run build | |
working-directory: ./osmosis/frontend | |
- name: Build package | |
run: python3 -m build | |
- name: Check for version change | |
uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
version: | |
- 'osmosis/version.py' | |
- name: Upload wheel artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheel | |
path: dist/*.whl | |
- name: Upload sdist artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
outputs: | |
version-changed: ${{ steps.changes.outputs.version }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: ${{ github.event.inputs.force-publish || github.ref == 'refs/heads/main' && needs.build.outputs.version-changed == 'true' }} | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Download wheel artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheel | |
path: dist/ | |
- name: Download sdist artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: sdist | |
path: dist/ | |
- name: Get package version | |
id: get-package-version | |
run: python -c "from osmosis import __version__; print(f\"version={__version__}\")" > $GITHUB_OUTPUT | |
- name: Publish to GitHub Releases | |
uses: ncipollo/release-action@v1 | |
with: | |
name: "v${{ steps.get-package-version.outputs.version }}" | |
tag: ${{ steps.get-package-version.outputs.version }} | |
artifacts: "dist/*.whl,dist/*.tar.gz" | |
generateReleaseNotes: true | |
draft: false | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |