Skip to content

Commit

Permalink
New release workflow (#570)
Browse files Browse the repository at this point in the history
* Minor fixes to the publish workflow
* Don't run publish workflow on forks
* Remove pre-commit job
* Get rid of deprecation warnings in publish-test
* New proposal, publish on release event
  • Loading branch information
danielhollas committed Mar 1, 2024
1 parent 4bf1ea8 commit bc64791
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 47 deletions.
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

0 comments on commit bc64791

Please sign in to comment.