Skip to content

Add success check for build_and_publish job #1129

Add success check for build_and_publish job

Add success check for build_and_publish job #1129

Workflow file for this run

name: Wheel building
on:
schedule:
# run every day at 4:30am UTC
- cron: '30 4 * * *'
pull_request:
# We also want this workflow triggered if the 'Build all wheels'
# label is added or present when PR is updated
types:
- synchronize
- labeled
push:
branches:
- '*'
tags:
- '*'
- '!*dev*'
- '!*pre*'
- '!*post*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build_and_publish:
permissions:
contents: none
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@2835f0cacddf3f8de198db9afdb5354a5cebe0ef # v2.6.3
if: |
github.repository == 'astropy/regions' &&
(
github.event_name == 'push' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.labels.*.name, 'Build all wheels')
)
with:
upload_to_pypi: false
save_artifacts: true
test_extras: test
test_command: pytest -p no:warnings --pyargs regions
targets: |
# Linux wheels
- cp3*-manylinux_x86_64
# MacOS X wheels
- cp3*-macosx_x86_64
- cp3*-macosx_arm64
# Windows wheels
- cp3*-win_amd64
# Developer wheels
upload_to_anaconda: >-
${{ (github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch')
}}
anaconda_user: astropy
anaconda_package: regions
anaconda_keep_n_latest: 10
secrets:
anaconda_token: ${{ secrets.anaconda_token }}
upload:
# This job publishes the built wheels to PyPI for all tags, except
# those ending in ".dev". For PRs with the "Build all wheels" label,
# wheels are built, but are not uploaded to PyPI.
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/project/regions
# We upload to PyPI for all tag pushes, except tags ending in .dev
if: |
needs.build_and_publish.result == 'success' &&
startsWith(github.ref, 'refs/tags/') &&
!endsWith(github.ref, '.dev') &&
(
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch'
)
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: [build_and_publish]
steps:
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
merge-multiple: true
pattern: dist-*
path: dist
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0