Skip to content
# © 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 }}
jobs:
is_publishable:
name: Check if version valid
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check version
run: cd .github/scripts && ./is_publishable.sh ${{ github.event.inputs.version }}
build_publish_sdist_and_x86_64:
name: Build and publish sdist and x86_64
needs: is_publishable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/package_solarwinds_apm_x86_64
- name: Install Twine
run: pip install --upgrade --no-cache-dir --prefer-binary twine
- name: Check distribution artifacts
run: twine check dist/*
- name: Publish sdist and x86_64 wheels to PyPi
env:
TWINE_NON_INTERACTIVE: 1
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.SW_APM_PYPI_UPLOAD_TOKEN }}
run: twine upload dist/*
launch_arm64:
name: Launch arm64 ec2 runners
needs:
- build_publish_sdist_and_x86_64
runs-on: ubuntu-latest
outputs:
label: ${{ steps.launch.outputs.label }} # github runner label
instance-id: ${{ steps.launch.outputs.instance-id }} # ec2 instance id
steps:
- uses: getsentry/action-github-app-token@v2
id: github-token
with:
app_id: ${{ vars.APPLICATION_ID }}
private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
- uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.API_CI_GHA_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.API_CI_GHA_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- id: launch
uses: solarwindscloud/ec2-runner-action@main
with:
action: launch
github-token: ${{ steps.github-token.outputs.token }}
runner-user: github
runner-directory: /gh
instance-type: t4g.medium
ami-name: gha-arm64-ubuntu22-.*
ami-owner: "858939916050"
subnet-id: subnet-0fd499f8a50e41807
security-group-ids: sg-0fd8d8cd6effda4a5
build_publish_aarch64:
name: Build and publish aarch64
needs:
- is_publishable
- launch_arm64
runs-on: ${{ needs.launch_arm64.outputs.label }}
steps:
- uses: actions/checkout@v3
- name: Build aarch64
uses: ./.github/actions/package_solarwinds_apm_aarch64
- name: Install Twine
run: pip install --upgrade --no-cache-dir --prefer-binary twine
- name: Check distribution artifacts
run: /gh/.local/bin/twine check dist/*
- name: Publish aarch64 wheels to TestPyPi
env:
TWINE_NON_INTERACTIVE: 1
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.SW_APM_PYPI_UPLOAD_TOKEN }}
run: /gh/.local/bin/twine upload dist/*.whl
terminate_arm64:
name: Terminate ec2 instances
if: ${{ always() }}
needs:
- launch_arm64
- build_publish_aarch64
runs-on: ubuntu-latest
steps:
- uses: getsentry/action-github-app-token@v2
id: github-token
with:
app_id: ${{ vars.APPLICATION_ID }}
private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
- uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.API_CI_GHA_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.API_CI_GHA_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- uses: solarwindscloud/ec2-runner-action@main
with:
action: terminate
github-token: ${{ steps.github-token.outputs.token }}
label: ${{ needs.launch_arm64.outputs.label }}
instance-id: ${{ needs.launch_arm64.outputs.instance-id }}
create_release:
name: Create draft release
needs: [build_publish_sdist_and_x86_64, build_publish_aarch64]
runs-on: ubuntu-latest
steps:
- uses: getsentry/action-github-app-token@v2
id: github-token
with:
app_id: ${{ vars.APPLICATION_ID }}
private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
- uses: actions/checkout@v3
- name: Initialize git
run: |
git config user.name "GitHub Actions"

Check failure on line 137 in .github/workflows/build_publish_pypi_and_draft_release.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/build_publish_pypi_and_draft_release.yaml

Invalid workflow file

You have an error in your yaml syntax on line 137
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: ${{ steps.github-token.outputs.token }}