Publish to PyPi and Create Release #149
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
# © 2023 SolarWinds Worldwide, LLC. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | |
name: Publish to PyPi and Create Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Semantic version of release (e.g. 1.0.0)' | |
required: true | |
env: | |
RELEASE_NAME: rel-${{ github.event.inputs.version }} | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
is_publishable: | |
name: Check if version valid | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check version | |
run: cd .github/scripts && ./is_publishable.sh ${{ github.event.inputs.version }} | |
get_apm_python_version: | |
name: Get APM Python version | |
needs: is_publishable | |
# Outputs SW_APM_VERSION | |
uses: ./.github/workflows/get_apm_python_version.yaml | |
build_sdist_and_x86_64: | |
name: Build sdist and x86_64 | |
needs: get_apm_python_version | |
# Outputs artifact-name | |
uses: ./.github/workflows/build_x86_64.yaml | |
with: | |
version: ${{ needs.get_apm_python_version.outputs.sw-apm-version }} | |
scan_sdist_and_x86_64: | |
name: RL scan aarch64 build | |
needs: | |
- get_apm_python_version | |
- build_sdist_and_x86_64 | |
uses: ./.github/workflows/reversinglabs_scan.yaml | |
with: | |
artifact-name: ${{ needs.build_sdist_and_x86_64.outputs.artifact-name }} | |
package-name: apm-python-pypi-sdist-x86_64 | |
version: ${{ needs.get_apm_python_version.outputs.sw-apm-version }} | |
secrets: inherit | |
publish_sdist_and_x86_64: | |
name: Publish sdist and x86_64 to PyPI | |
needs: | |
- build_sdist_and_x86_64 | |
- scan_sdist_and_x86_64 | |
uses: ./.github/workflows/publish_x86_64.yaml | |
with: | |
artifact-name: ${{ needs.build_sdist_and_x86_64.outputs.artifact-name }} | |
repository-name: pypi | |
secrets: inherit | |
build_aarch64: | |
name: Build aarch64 | |
needs: get_apm_python_version | |
# Outputs artifact-name | |
uses: ./.github/workflows/build_aarch64.yaml | |
with: | |
version: ${{ needs.get_apm_python_version.outputs.sw-apm-version }} | |
scan_aarch64: | |
name: RL scan aarch64 build | |
needs: | |
- get_apm_python_version | |
- build_aarch64 | |
uses: ./.github/workflows/reversinglabs_scan.yaml | |
with: | |
artifact-name: ${{ needs.build_aarch64.outputs.artifact-name }} | |
package-name: apm-python-pypi-aarch64 | |
version: ${{ needs.get_apm_python_version.outputs.sw-apm-version }} | |
secrets: inherit | |
publish_aarch64: | |
name: Publish aarch64 to PyPI | |
needs: | |
- build_aarch64 | |
- scan_aarch64 | |
uses: ./.github/workflows/publish_aarch64.yaml | |
with: | |
artifact-name: ${{ needs.build_aarch64.outputs.artifact-name }} | |
repository-name: pypi | |
secrets: inherit | |
create_release: | |
name: Create draft release | |
needs: [publish_sdist_and_x86_64, publish_aarch64] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: getsentry/action-github-app-token@v3 | |
id: github-token | |
with: | |
app_id: ${{ vars.APPLICATION_ID }} | |
private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
- name: Initialize git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email noreply@github.com | |
- name: Create draft release | |
run: gh release create ${{ env.RELEASE_NAME }} --title "${{ env.RELEASE_NAME }}" --target release/${{ env.RELEASE_NAME }} --draft | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |