Merge pull request #124 from nxt-dev/dev #5
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| branches: [release] | |
| workflow_dispatch: | |
| branches: [release] | |
| workflow_call: | |
| inputs: | |
| QT_DEPENDENCIES: | |
| description: 'Set to true to install Qt dependencies (Linux)' | |
| required: false | |
| default: 'false' | |
| type: string | |
| jobs: | |
| run-tests: | |
| uses: nxt-dev/nxt/.github/workflows/unittests.yml@release | |
| with: | |
| QT_DEPENDENCIES: ${{ inputs.QT_DEPENDENCIES }} | |
| changed-files: | |
| runs-on: ubuntu-latest | |
| name: Check if source actually changed | |
| outputs: | |
| any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v46.0.5 | |
| with: | |
| files: | | |
| nxt/** | |
| nxt_editor/** | |
| build-and-deploy-pypi: | |
| needs: [run-tests, changed-files] | |
| if: needs.changed-files.outputs.any_changed == 'true' | |
| runs-on: ubuntu-latest | |
| env: | |
| TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Checkout build graph (if needed) | |
| if: github.repository != 'nxt-dev/nxt' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: nxt-dev/nxt | |
| ref: release | |
| path: nxt | |
| sparse-checkout: build | |
| - name: Install Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Ensure PIP | |
| run: python -m ensurepip --upgrade | |
| - name: Install nxt-core (if needed) | |
| if: github.repository != 'nxt-dev/nxt' | |
| run: | | |
| pip install git+https://github.com/nxt-dev/nxt.git@release | |
| - name: Install this package and dependencies | |
| run: | | |
| pip install twine | |
| pip install . | |
| - name: Set NXT_FILE_ROOTS (if needed) | |
| if: github.repository != 'nxt-dev/nxt' | |
| env: | |
| # Thepackaging graph expects nxt to be cloned next to nxt_editor | |
| # this is not possible in GHA so we abuse the file fall backs to | |
| # trick it into working | |
| NXT_FILE_ROOTS: '../docs/api_docs' | |
| run: echo "NXT_FILE_ROOTS=$NXT_FILE_ROOTS" >> $GITHUB_ENV | |
| - name: Build package and upload | |
| run: | | |
| python -m nxt.cli -vv exec build/packaging.nxt -s /make_and_upload | |
| skip-build: | |
| name: Skipped build because source did not change | |
| needs: [changed-files] | |
| runs-on: ubuntu-latest | |
| if: needs.changed-files.outputs.any_changed != 'true' | |
| steps: | |
| - run: echo "No changes in nxt or nxt_editor, skipping build and upload to PyPI." |