Automate release creation (take 5) #7
Workflow file for this run
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: Publish to pypi.org | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install pip build | |
run: pip install build | |
- name: Build wheel and sdist | |
run: python -m build --sdist --wheel | |
- name: Create GitHub release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload release artifacts | |
uses: korniltsev/actions-upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "dist/*" | |
publish: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: robinraju/[email protected] | |
with: | |
tag: ${{ github.ref }} | |
fileName: "*" | |
tarBall: false | |
zipBall: false | |
out-file-path: "dist" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: grafana/shared-workflows/actions/get-vault-secrets@main | |
with: | |
vault_instance: dev | |
# Secrets placed in the ci/repo/grafana/otel-profiling-python/ path in Vault | |
repo_secrets: | | |
PYPI_API_TOKEN=publishing:pypi_api_key | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ env.PYPI_API_TOKEN }} |