Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

CI: add release workflow #1627

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ jobs:
environment:
TOXENV: tests311

release:
docker:
- image: curlimages/curl:7.72.0
steps:
- run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_WORKFLOW_DISPATCH_TOKEN"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/actions/workflows/release.yml/dispatches \
-d '{"ref":"'$CIRCLE_BRANCH'"}'

workflows:
version: 2
build_and_test:
Expand Down Expand Up @@ -102,3 +115,19 @@ workflows:
- tests311:
requires:
- quality
- release:
requires:
- tests38-fast
- tests38-online
- tests38-slow
- tests38-images
- tests38-coverage
- tests39
- tests310
- tests311
filters:
tags:
only:
- /^v.*/
branches:
ignore: /.*/
74 changes: 74 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: "Release"
on:
# HACK: this workflow can only be triggered by a workflow dispatch comming
# from the CircleCI pipelines. This is the only way to guarantee the right
# execution order of the different steps involved in the global CI/CD
# pipeline.
workflow_dispatch:

env:
MAIN_PYTHON_VERSION: '3.10'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

build-library:
name: "Build poliastro in ${{ matrix.os }} with Python ${{ matrix.python-version }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:

- name: "Checkout project"
uses: actions/checkout@v3

- name: "Install Python ${{ matrix.os }}"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: "Install dependencies"
run: |
python -m pip install -U pip build twine

- name: "Build distribution artifacts"
run: |
python -m build .

- name: "Verify healthy of artifacts"
run: |
python -m twine check dist/*

- name: "Upload artifacts"
uses: actions/upload-artifact@v2
with:
name: "poliastro-dist-${{ matrix.os }}-py${{ matrix.python-version }}"
path: dist

release:
name: "Release poliastro"
needs: build-library
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:

- name: "Download all artifacts"
uses: actions/download-artifact@v3
with:
path: dist

- name: "Upload artifacts to private PyPI"
shell: bash
if: inputs.dry-run == 'false'
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m twine upload --verbose --skip-existing dist/*.whl
python -m twine upload --verbose --skip-existing dist/*.tar.gz