Skip to content

Commit

Permalink
Update the release.yml file
Browse files Browse the repository at this point in the history
This now more closely follows the guidance provided about this.
  • Loading branch information
pradyunsg committed Apr 27, 2024
1 parent e1a55d5 commit e157950
Showing 1 changed file with 79 additions and 29 deletions.
108 changes: 79 additions & 29 deletions .github/workflows/release.yml
Expand Up @@ -2,47 +2,97 @@
# and then try to upload to TestPyPI. The second step seems to be consistently
# failing. :)

name: Release
on:
push:
tags:
- "*"

permissions:
id-token: write
contents: write
name: Build and release
on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-python@v4
with:
python-version: "3.x"

- run: pip install build
- run: python -m build

- name: Install dependencies
run: pip install build
- uses: actions/upload-artifact@v4
with:
name: distributions
path: dist/

publish-pypi:
runs-on: ubuntu-latest

- name: Generate final distribution
run: python -m build
if: startsWith(github.ref, 'refs/tags/')
needs: [build]

- name: Upload source distribution as an action artifact
uses: actions/upload-artifact@v4
environment:
name: release
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: sdist
path: dist/furo-*.tar.gz
- name: Upload wheel distribution as an action artifact
uses: actions/upload-artifact@v4
name: python-package-distributions
path: dist/

- uses: pypa/gh-action-pypi-publish@release/v1

publish-testpypi:
runs-on: ubuntu-latest

if: startsWith(github.ref, 'refs/tags/')
needs: [build]

environment:
name: release
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: wheel
path: dist/furo-*-py3-none-any.whl
name: python-package-distributions
path: dist/

- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

github-release:
runs-on: ubuntu-latest

needs: [publish-to-testpypi]

permissions:
contents: write
id-token: write

- name: Make a GitHub Release
uses: softprops/action-gh-release@v2
steps:
- uses: actions/download-artifact@v3
with:
files: dist/*
name: python-package-distributions
path: dist/

- name: Upload to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
- uses: sigstore/gh-action-sigstore-python@v1.2.3
with:
repository_url: https://test.pypi.org/legacy/
verbose: true
inputs: ./dist/*.tar.gz ./dist/*.whl

- name: Create a GitHub release
run: >-
gh release create --repo '${{ github.repository }}'
'${{ github.ref_name }}'
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload signed release files to GitHub release
run: >-
gh release upload --repo '${{ github.repository }}'
'${{ github.ref_name }}'
dist/**
env:
GITHUB_TOKEN: ${{ github.token }}

0 comments on commit e157950

Please sign in to comment.