Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New release workflow #570

Merged
merged 6 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,8 @@ concurrency:

jobs:

pre-commit:
# Adapted from: https://github.com/CasperWA/voila-optimade-client

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
cache-dependency-path: |
.pre-commit-config.yaml
**/setup.cfg
**/pyproject.toml
**/requirements*.txt

- uses: pre-commit/action@v3.0.1

test-notebooks:

needs: [pre-commit]

strategy:
matrix:
browser: [Chrome, Firefox]
Expand Down Expand Up @@ -103,8 +80,6 @@ jobs:

test-package:

needs: [pre-commit]

strategy:
matrix:
python-version: ['3.9', '3.10']
Expand Down
31 changes: 9 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
name: Publish on Test PyPI and PyPI

on:
push:
pull_request:
branches:
# Commits pushed to release/ branches are published on Test PyPI if they
# have a new version number.
# Commits pushed to release/ branches are published on Test PyPI if they
# have a new version number.
- release/**
tags:
# Tags that start with the "v" prefix are published on PyPI.
- v*
release:

jobs:

Expand Down Expand Up @@ -47,9 +45,7 @@ jobs:
publish-test:

name: Build and publish on TestPyPI
if: >
startsWith(github.ref, 'refs/heads/release/') ||
startsWith(github.ref, 'refs/tags/')
if: github.repository_owner == 'aiidalab'

needs: [build]
runs-on: ubuntu-latest
Expand All @@ -67,19 +63,18 @@ jobs:

- name: Publish distribution on Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/heads/release/')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
repository-url: https://test.pypi.org/legacy/
skip-existing: true

publish:

name: Build and publish on PyPI
if: startsWith(github.ref, 'refs/tags')
if: startsWith(github.ref, 'refs/tags/v') && github.repository_owner == 'aiidalab'

needs: [build]
needs: [build, publish-test]
runs-on: ubuntu-latest

environment:
Expand All @@ -94,14 +89,6 @@ jobs:
name: release
path: dist/

- uses: softprops/action-gh-release@v0.1.15
name: Create release
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
dist/*
generate_release_notes: true

- name: Publish distribution on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down