Skip to content

Release

Release #1

Workflow file for this run

name: Release
# Reusable workflow are not supported with trusted publisher
# https://github.com/pypa/gh-action-pypi-publish/issues/166
# copy and paste
# https://github.com/hyperspy/.github/blob/main/.github/workflows/release_pure_python.yml
# This workflow builds the wheels "on tag".
# If run from the hyperspy/hyperspy repository, the wheels will be uploaded to pypi ;
# otherwise, the wheels will be available as a github artifact.
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
package_and_test:
name: Package and Test
# Use the "reusable workflow" from the hyperspy organisation
uses: hyperspy/.github/.github/workflows/package_and_test.yml@main
upload_to_pypi:
needs: [package_and_test]
runs-on: ubuntu-latest
name: Upload to pypi
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Download dist
uses: actions/download-artifact@v3
- name: Display downloaded files
run: |
ls -shR
working-directory: dist
- uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'hyperspy' }}
# See https://docs.pypi.org/trusted-publishers/using-a-publisher/
create_github_release:
# If zenodo is setup to create a DOI automatically on a GitHub release,
# this step will trigger the mining of the DOI
needs: upload_to_pypi
permissions:
contents: write
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'hyperspy' }}
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844