24.10.rc1 #18
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 | ||
| description: Compile, Build, Publish on PyPI, Release on GitHub | ||
| # I store spm-version in run-name so that it can be retrived in release-rXXXXY | ||
| run-name: ${{ inputs.spm-version }} | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| spm-version: | ||
| description: 'SPM Commit / Branch / Tag / SHA to checkout' | ||
| required: false | ||
| default: 'main' | ||
| matlab-version: | ||
| description: 'MATLAB release' | ||
| required: false | ||
| default: 'R2024b' | ||
| # ====================================================================== | ||
| jobs: | ||
| # -------------------------------------------------------------------- | ||
| guess-version: | ||
| uses: ./.github/workflows/guess_version.yml | ||
| with: | ||
| spm-version: ${{ inputs.spm-version }} | ||
| # -------------------------------------------------------------------- | ||
| compile: | ||
| needs: guess-version | ||
| uses: ./.github/workflows/compile.yml | ||
| with: | ||
| spm-version: ${{ inputs.spm-version }} | ||
| matlab-version: ${{ inputs.matlab-version }} | ||
| # -------------------------------------------------------------------- | ||
| build: | ||
| needs: compile | ||
| uses: ./.github/workflows/build.yml | ||
| with: | ||
| spm-version: ${{ inputs.spm-version }} | ||
| matlab-version: ${{ inputs.matlab-version }} | ||
| main-package: true | ||
| secrets: inherit | ||
| # -------------------------------------------------------------------- | ||
| publish-test-pypi: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: testpypi | ||
| url: https://test.pypi.org/p/spm-runtime | ||
| permissions: | ||
| id-token: write # IMPORTANT: mandatory for trusted publishing | ||
| steps: | ||
| - name: Download distribution | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: spm_${{ inputs.spm-version }}_${{ inputs.matlab-version }}.dist | ||
| path: dist/ | ||
| # - name: Publish distribution 📦 to Test PyPI | ||
| # uses: pypa/gh-action-pypi-publish@release/v1 | ||
| # with: | ||
| # repository-url: https://test.pypi.org/legacy/ | ||
| # -------------------------------------------------------------------- | ||
| publish-pypi: | ||
| needs: publish-test-pypi | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/p/spm-runtime | ||
| permissions: | ||
| id-token: write # IMPORTANT: mandatory for trusted publishing | ||
| steps: | ||
| - name: Download distribution | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: spm_${{ inputs.spm-version }}_${{ inputs.matlab-version }}.dist | ||
| path: dist/ | ||
| # - name: Publish distribution 📦 to PyPI | ||
| # uses: pypa/gh-action-pypi-publish@release/v1 | ||
| # -------------------------------------------------------------------- | ||
| github-release: | ||
| needs: publish-pypi | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # IMPORTANT: mandatory for making GitHub Releases | ||
| id-token: write # IMPORTANT: mandatory for sigstore | ||
| steps: | ||
| - name: Download all the dists | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: spm_${{ inputs.spm-version }}_${{ inputs.matlab-version }}.dist | ||
| path: dist/ | ||
| - name: Sign the dists with Sigstore | ||
| uses: sigstore/gh-action-sigstore-python@v3.0.0 | ||
| with: | ||
| inputs: >- | ||
| ./dist/*.tar.gz | ||
| ./dist/*.whl | ||
| - name: Create GitHub Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| SPM_VERSION: ${{ inputs.spm-version }} | ||
| MATLAB_VERSION: ${{ inputs.matlab-version }} | ||
| run: | | ||
| gh release create "$VERSION" --repo "$GITHUB_REPOSITORY" \ | ||
| --notes "SPM $SPM_VERSION compiled with MATLAB $MATLAB_VERSION" | ||
| - name: Upload artifact signatures to GitHub Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| # Upload to GitHub Release using the `gh` CLI. | ||
| # `dist/` contains the built packages, and the | ||
| # sigstore-produced signatures and certificates. | ||
| run: | | ||
| gh release upload "$VERSION" dist/** --repo "$GITHUB_REPOSITORY" | ||