Vibrational analysis workflow (#12) #16
This file contains hidden or 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: ci-release | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - v[0-9]+.[0-9]+.[0-9]+* | |
| jobs: | |
| publish-release: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'stfc/aiidalab-chemshell' && startsWith(github.ref, 'refs/tags/v') | |
| environment: | |
| name: release | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build & twine | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build the package | |
| run: python -m build . | |
| - name: Install the package to get the version | |
| run: pip install . | |
| - name: Extract the package version | |
| run: | | |
| echo "VERSION=$(python -c ' | |
| from aiidalab_chemshell import __version__ | |
| print(__version__) | |
| ')" >> $GITHUB_ENV | |
| - name: Compare package version to git tag | |
| if: ${{ ! contains(github.ref, env.VERSION) }} | |
| run: | | |
| echo "Git tag does not match package version." | |
| exit 1 | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: "dist/*" | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| draft: false | |
| prerelease: steps.check-prerelease.output.prerelease == 'true' | |
| skipIfReleaseExists: true | |
| generateReleaseNotes: true | |
| - name: Publish to PyPI | |
| run: twine upload dist/* |