codegen-examples is dead, long live codegen-examples #620
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: Build & Release | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| branches: | |
| - develop | |
| pull_request: | |
| branches: | |
| - develop | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build 3.${{ matrix.python }} ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ | |
| ubuntu-latest, | |
| ubuntu-24.04-arm, # https://github.com/actions/partner-runner-images/issues/37 | |
| macos-latest, | |
| ] | |
| python: [ | |
| 12, | |
| 13, | |
| ] | |
| steps: | |
| - name: Github context | |
| env: | |
| GITHUB_CONTEXT: ${{ toJson(github) }} | |
| run: echo "$GITHUB_CONTEXT" | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.head.ref || github.ref }} | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@v5.2 | |
| id: setup-uv | |
| with: | |
| enable-cache: false | |
| prune-cache: false | |
| python-version: 3.${{ matrix.python }} | |
| version: '0.5.24' | |
| cache-suffix: 3.${{ matrix.python }} | |
| - name: Fetch tags | |
| run: | | |
| git branch | |
| git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
| # TODO: add cbuildwheel cache | |
| - name: Build wheel | |
| uses: pypa/cibuildwheel@v2.22.0 | |
| env: | |
| CIBW_BUILD: "*cp3${{ matrix.python }}*" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }}-3.${{ matrix.python }} | |
| path: ./wheelhouse/*.whl | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: write # grants permission to create a release on github | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup backend | |
| uses: ./.github/actions/setup-environment | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| pattern: wheels-* | |
| - name: Release PyPI | |
| run: | | |
| export UV_PUBLISH_PASSWORD="${{ secrets.PYPI_TOKEN }}" | |
| export UV_PUBLISH_USERNAME="__token__" | |
| uv publish --publish-url https://upload.pypi.org/legacy/ | |
| - name: Github release | |
| id: github-release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/* | |
| fail_on_unmatched_files: true | |
| generate_release_notes: true | |
| # TODO: use python exec instead | |
| - uses: slackapi/slack-github-action@v2.0.0 | |
| if: always() | |
| with: | |
| method: chat.postMessage | |
| token: ${{ secrets.SLACK_BOT_TOKEN }} | |
| payload: | | |
| username: ${{ job.status == 'success' && format('Released codegen@{0}', github.ref_name) || format('Failed to release codegen@{0}', github.ref_name) }} | |
| channel: "#release" | |
| icon_emoji: "${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}" | |
| text: | | |
| Actor: `${{ github.triggering_actor }}` | |
| Author: `${{ github.event.head_commit.author.username }}` | |
| ${{ format('Commit: <{0}/{1}/commit/{2}|{1}@{2}>', github.server_url, github.repository, github.sha) || ''}} | |
| View <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|GHA logs> |