Merge pull request #549 from scipp/fix_license #14
Workflow file for this run
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: | |
| tags: | |
| - "*/[0-9]*" | |
| jobs: | |
| determine-package: | |
| name: Determine package | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| package: ${{ steps.parse.outputs.package }} | |
| version: ${{ steps.parse.outputs.version }} | |
| steps: | |
| - id: parse | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| PACKAGE="${TAG%%/*}" | |
| VERSION="${TAG#*/}" | |
| echo "package=${PACKAGE}" >> "$GITHUB_OUTPUT" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| build: | |
| name: Build ${{ needs.determine-package.outputs.package }} | |
| needs: determine-package | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Copy LICENSE into package | |
| run: cp LICENSE packages/${{ needs.determine-package.outputs.package }}/LICENSE | |
| - name: Build package | |
| run: pip install build && python -m build packages/${{ needs.determine-package.outputs.package }} | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist | |
| path: packages/${{ needs.determine-package.outputs.package }}/dist/ | |
| publish: | |
| name: Publish to PyPI | |
| needs: [determine-package, build] | |
| runs-on: ubuntu-24.04 | |
| environment: release | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ | |
| docs: | |
| name: Publish docs | |
| needs: [determine-package, publish] | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: prefix-dev/setup-pixi@v0.9.4 | |
| with: | |
| frozen: true | |
| environments: docs-${{ needs.determine-package.outputs.package }} | |
| - name: Build docs | |
| run: pixi run docs-${{ needs.determine-package.outputs.package }} | |
| - name: Prepare site | |
| run: | | |
| PACKAGE=${{ needs.determine-package.outputs.package }} | |
| git fetch origin gh-pages:gh-pages || true | |
| git worktree add gh-pages-site gh-pages || mkdir -p gh-pages-site | |
| rm -rf gh-pages-site/$PACKAGE | |
| cp -r packages/$PACKAGE/html gh-pages-site/$PACKAGE | |
| cp docs/index.html gh-pages-site/index.html | |
| touch gh-pages-site/.nojekyll | |
| - name: Build search index | |
| run: npx pagefind@latest --site gh-pages-site --bundle-dir pagefind | |
| - uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: gh-pages | |
| folder: gh-pages-site | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: docs_html | |
| path: packages/${{ needs.determine-package.outputs.package }}/html | |
| assets: | |
| name: Upload docs | |
| needs: [docs, determine-package] | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: docs_html | |
| path: docs_html | |
| - name: Zip documentation | |
| run: | | |
| PACKAGE=${{ needs.determine-package.outputs.package }} | |
| VERSION=${{ needs.determine-package.outputs.version }} | |
| mv docs_html documentation-${PACKAGE}-${VERSION} | |
| zip -r documentation-${PACKAGE}-${VERSION}.zip documentation-${PACKAGE}-${VERSION} | |
| - name: Upload release assets | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| file: ./documentation-${{ needs.determine-package.outputs.package }}-${{ needs.determine-package.outputs.version }}.zip | |
| overwrite: false |