schedule: refs/heads/main #501
This file contains 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
# Project's main software development workflow. | |
name: "Workflow" | |
run-name: "${{ github.event_name }}: ${{ github.ref }}" | |
on: | |
issues: | |
types: | |
- opened | |
- labeled | |
issue_comment: | |
types: | |
- created | |
- edited | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
- labeled | |
pull_request_target: | |
types: | |
- opened | |
# push: | |
schedule: | |
- cron: '43 23 * * *' # Every day at 23:43 UTC. | |
- cron: '43 6 * * 6' # Every Saturday at 6:43 UTC. | |
workflow_dispatch: | |
inputs: | |
config: | |
description: Configuration | |
type: choice | |
options: | |
- disable | |
- report | |
- pull | |
- pull & merge | |
- commit | |
default: report | |
required: true | |
lint: | |
description: Lint | |
type: choice | |
options: | |
- disable | |
- report | |
- pull | |
- pull & merge | |
- commit | |
default: report | |
required: true | |
build: | |
description: Build | |
type: boolean | |
default: false | |
required: true | |
test: | |
description: Test | |
type: boolean | |
default: false | |
required: true | |
website: | |
description: Website | |
type: boolean | |
default: false | |
required: true | |
release: | |
description: Release v1 | |
type: boolean | |
default: false | |
required: true | |
jobs: | |
init: | |
name: 'Project' | |
# If the event is 'pull_request_target', only run if its from a fork. | |
if: >- | |
github.event_name != 'pull_request_target' | |
|| github.event.pull_request.head.repo.full_name != github.repository | |
uses: ./.github/workflows/_manager.yaml | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
# with: | |
# package-build: ${{ inputs.package-build || false }} | |
# package-lint: ${{ inputs.package-lint || false }} | |
# package-test: ${{ inputs.package-test || false }} | |
# website-build: ${{ inputs.website-build || false }} | |
# meta-sync: ${{ inputs.meta-sync }} | |
# hooks: ${{ inputs.hooks }} | |
# first-major-release: ${{ inputs.first-major-release || false }} | |
secrets: | |
repo-admin-token: ${{ secrets.REPO_ADMIN_TOKEN }} | |
website: | |
name: 'Website' | |
needs: init | |
if: fromJSON(needs.init.outputs.run).website # fromJSON(needs.init.outputs.config).run.website_build | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: GitHub Pages | |
url: ${{ fromJSON(needs.init.outputs.website).url }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: ${{ fromJSON(needs.init.outputs.website) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: RepoDynamics/SphinxDocs@v1 | |
with: | |
repository: ${{ matrix.config.repository }} | |
ref: ${{ matrix.config.ref }} | |
deploy: ${{ matrix.config.deploy }} | |
path-website: ${{ matrix.config.path-website }} | |
path-package-setup: ${{ matrix.config.path-package }} | |
artifact-name: ${{ matrix.config.artifact-name }} | |
lint: | |
name: 'Package Lint' | |
needs: init | |
if: fromJSON(needs.init.outputs.run).lint # fromJSON(needs.init.outputs.config).run.package_lint | |
permissions: | |
pull-requests: write | |
security-events: write | |
actions: read | |
contents: read | |
strategy: | |
fail-fast: false | |
matrix: | |
config: ${{ fromJSON(needs.init.outputs.lint) }} | |
uses: ./.github/workflows/_pkg_lint.yaml | |
with: | |
config: ${{ toJSON(matrix.config) }} | |
# metadata: ${{ needs.init.outputs.metadata }} | |
# ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }} | |
# ref-before: ${{ fromJSON(needs.init.outputs.config).checkout.ref_before }} | |
test: | |
name: 'Package Test' | |
needs: init | |
if: fromJSON(needs.init.outputs.run).test # fromJSON(needs.init.outputs.config).run.package_test_local | |
uses: ./.github/workflows/_pkg_test.yaml | |
with: | |
config: ${{ needs.init.outputs.test }} | |
# metadata: ${{ needs.init.outputs.metadata }} | |
# package-source: GitHub | |
build: | |
name: 'Package Build' | |
needs: init | |
if: fromJSON(needs.init.outputs.run).build # fromJSON(needs.init.outputs.config).run.package_build | |
strategy: | |
fail-fast: false | |
matrix: | |
config: ${{ fromJSON(needs.init.outputs.build) }} | |
uses: ./.github/workflows/_pkg_build.yaml | |
with: | |
config: ${{ toJSON(matrix.config) }} | |
# metadata: ${{ needs.init.outputs.metadata }} | |
# ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }} | |
# repository: ${{ fromJSON(needs.init.outputs.config).checkout.repository }} | |
publish-testpypi: | |
name: 'Package Publish' | |
needs: [init, build, test, lint] | |
if: fromJSON(needs.init.outputs.run).publish-testpypi # fromJSON(needs.init.outputs.config).run.package_publish_testpypi | |
permissions: | |
id-token: write | |
uses: ./.github/workflows/_pkg_publish.yaml | |
with: | |
config: ${{ needs.init.outputs.publish-testpypi }} | |
# platform: TestPyPI | |
# download-url: ${{ fromJSON(needs.init.outputs.config).package.download_url_testpypi }} | |
# upload-url: ${{ fromJSON(needs.init.outputs.config).package.upload_url_testpypi }} | |
test-testpypi: | |
name: 'Package Test: TestPyPI' | |
needs: [init, publish-testpypi] | |
if: fromJSON(needs.init.outputs.run).test-testpypi # ${{ !failure() && fromJSON(needs.init.outputs.config).run.package_test_testpypi }} | |
uses: ./.github/workflows/_pkg_test.yaml | |
with: | |
config: ${{ needs.init.outputs.test-testpypi }} | |
# config: ${{ needs.init.outputs.config }} | |
# metadata: ${{ needs.init.outputs.metadata }} | |
# package-source: TestPyPI | |
publish-pypi: | |
name: 'Package Publish' | |
needs: [init, test-testpypi] | |
if: fromJSON(needs.init.outputs.run).publish-pypi # ${{ !failure() && fromJSON(needs.init.outputs.config).run.package_publish_pypi }} | |
permissions: | |
id-token: write | |
uses: ./.github/workflows/_pkg_publish.yaml | |
with: | |
config: ${{ needs.init.outputs.publish-pypi }} | |
# platform: PyPI | |
# download-url: ${{ fromJSON(needs.init.outputs.config).package.download_url_pypi }} | |
# upload-url: ${{ fromJSON(needs.init.outputs.config).package.upload_url_pypi }} | |
test-pypi: | |
name: 'Package Test: PyPI' | |
needs: [init, publish-pypi] | |
if: fromJSON(needs.init.outputs.run).test-pypi # ${{ !failure() && fromJSON(needs.init.outputs.config).run.package_test_pypi }} | |
uses: ./.github/workflows/_pkg_test.yaml | |
with: | |
config: ${{ needs.init.outputs.test-pypi }} | |
# config: ${{ needs.init.outputs.config }} | |
# metadata: ${{ needs.init.outputs.metadata }} | |
# package-source: PyPI | |
finalize: | |
name: 'Finalize' | |
needs: [ init, build, website, test-pypi ] | |
if: ${{ !failure() && fromJSON(needs.init.outputs.run).finalize }} | |
permissions: | |
contents: write | |
discussions: write | |
runs-on: ubuntu-latest | |
steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# with: | |
# ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }} | |
- name: 'Download sdist and wheels artifacts' | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ fromJSON(needs.init.outputs.finalize).release.package-artifact-name }} | |
path: distribution | |
- name: 'Download gh-pages artifact' | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ fromJSON(needs.init.outputs.finalize).release.website-artifact-name }} | |
path: documentation | |
- name: 'Zip artifacts' | |
run: | | |
mv distribution/dist/*.tar.gz ./ | |
zip -r wheels.zip distribution/dist | |
zip -r documentation.zip documentation | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ fromJSON(needs.init.outputs.finalize).release.name }} | |
tag_name: ${{ fromJSON(needs.init.outputs.finalize).release.tag-name }} | |
body: ${{ fromJSON(needs.init.outputs.finalize).release.body }} | |
prerelease: ${{ fromJSON(needs.init.outputs.finalize).release.prerelease }} | |
# discussion_category_name: ${{ fromJSON(needs.init.outputs.finalize).release.discussion_category_name }} | |
files: | | |
wheels.zip | |
documentation.zip | |
*.tar.gz |