Build and publish CPython #108
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 CPython | |
on: | |
workflow_dispatch: | |
inputs: | |
python_version: | |
required: true | |
type: string | |
beta: | |
required: false | |
type: boolean | |
default: false | |
workflow_call: | |
inputs: | |
python_version: | |
required: true | |
type: string | |
beta: | |
required: false | |
type: boolean | |
default: false | |
jobs: | |
build: | |
name: Build CPython ${{ inputs.python_version }} | |
uses: ./.github/workflows/build_python.yml | |
with: | |
python_version: ${{ inputs.python_version }} | |
platforms: "linux-x86_64,linux-aarch64,linux-i386,linux-arm,linux-riscv64,macos,windows,cosmo,freebsd13-x86_64,freebsd14-x86_64" | |
publish: | |
name: Publish CPython ${{ inputs.python_version }} | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get tags | |
run: git fetch --tags origin | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: python-* | |
path: /tmp/python/ | |
merge-multiple: true | |
- name: Get latest | |
run: | | |
echo "LATEST_TAG=$(./scripts/pick_semver.sh ${{ inputs.python_version }} ${{ inputs.beta }} cpython true)" >> $GITHUB_ENV | |
- name: Pick tag | |
id: pick_tag | |
run: | | |
SELECTED_TAG=$(./scripts/pick_semver.sh ${{ inputs.python_version }} ${{ inputs.beta }} cpython) | |
echo "SELECTED_TAG=$SELECTED_TAG" >> $GITHUB_ENV | |
echo "::set-output name=release_tag::$SELECTED_TAG" | |
- name: Create release | |
run: | | |
gh release create ${{ env.SELECTED_TAG }} \ | |
--title ${{ env.SELECTED_TAG }} \ | |
--target ${{ github.sha }} \ | |
${{ env.LATEST_TAG && format('--generate-notes --notes-start-tag {0}', env.LATEST_TAG) || format('--notes "Python {0}"', inputs.python_version) }} \ | |
${{ inputs.beta && '--prerelease' || '' }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload files | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: /tmp/python/python*.zip | |
tag_name: ${{ env.SELECTED_TAG }} | |
outputs: | |
release_tag: ${{ steps.pick_tag.outputs.release_tag }} | |
update_installers: | |
name: Update installers | |
needs: publish | |
permissions: | |
contents: write | |
uses: ./.github/workflows/update_nodejs_installers.yml | |
with: | |
version: ${{ inputs.python_version }} | |
release_tag: ${{ needs.publish.outputs.release_tag }} | |
beta: ${{ inputs.beta }} | |
implementation: cpython | |
secrets: inherit |