push: refs/heads/main #640
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 | |
- edited | |
- labeled | |
- assigned | |
- unassigned | |
- unlabeled | |
- locked | |
- unlocked | |
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. | |
# TODO: Remove the first line after PyPackIT finalization. | |
if: >- | |
github.repository != 'RepoDynamics/PyPackIT' | |
&& ( | |
( | |
github.event_name != 'pull_request_target' | |
|| github.event.pull_request.head.repo.full_name != github.repository | |
) && ( | |
github.event_name != 'push' | |
|| (github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch) | |
) | |
) | |
uses: ./.github/workflows/_manager.yaml | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
secrets: | |
repo-admin-token: ${{ secrets.REPO_ADMIN_TOKEN }} | |
zenodo-token: ${{ secrets.ZENODO_TOKEN }} | |
web-build: | |
name: ${{ matrix.config.job-name }} | |
needs: init | |
if: fromJSON(needs.init.outputs.run).web-build | |
strategy: | |
fail-fast: false | |
matrix: | |
config: ${{ fromJSON(needs.init.outputs.web-build) }} | |
uses: ./.github/workflows/_web_build.yaml | |
with: | |
config: ${{ toJSON(matrix.config) }} | |
web-deploy: | |
name: ${{ fromJSON(needs.init.outputs.web-deploy).job-name }} | |
if: fromJSON(needs.init.outputs.run).web-deploy | |
needs: [ init, web-build ] | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: ${{ fromJSON(needs.init.outputs.web-deploy).env-name }} | |
url: ${{ fromJSON(needs.init.outputs.web-deploy).env-url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: GH-Pages Configuration | |
id: configure-pages | |
uses: actions/configure-pages@v5 # https://github.com/actions/configure-pages | |
- name: GH-Pages Deployment | |
id: deploy | |
uses: actions/deploy-pages@v4 # https://github.com/actions/deploy-pages | |
with: | |
artifact_name: ${{ fromJSON(needs.init.outputs.web-deploy).pages-artifact-name }} | |
lint: | |
name: ${{ matrix.config.job-name }} | |
needs: init | |
if: fromJSON(needs.init.outputs.run).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) }} | |
test: | |
name: Package Test${{ matrix.config.job-name }} | |
needs: init | |
if: fromJSON(needs.init.outputs.run).test | |
permissions: | |
id-token: write | |
strategy: | |
fail-fast: false | |
matrix: | |
config: ${{ fromJSON(needs.init.outputs.test) }} | |
uses: ./.github/workflows/_pkg_test.yaml | |
with: | |
config: ${{ toJSON(matrix.config.config) }} | |
build: | |
name: ${{ matrix.config.job-name }} | |
needs: init | |
if: fromJSON(needs.init.outputs.run).build | |
strategy: | |
fail-fast: false | |
matrix: | |
config: ${{ fromJSON(needs.init.outputs.build) }} | |
uses: ./.github/workflows/_pkg_build.yaml | |
with: | |
config: ${{ toJSON(matrix.config) }} | |
publish-testpypi: | |
name: 'Package Publish' | |
needs: [init, build, test, lint] | |
if: fromJSON(needs.init.outputs.run).publish-testpypi | |
permissions: | |
id-token: write | |
strategy: | |
fail-fast: false | |
matrix: | |
config: ${{ fromJSON(needs.init.outputs.web-build) }} | |
uses: ./.github/workflows/_pkg_publish.yaml | |
with: | |
config: ${{ needs.init.outputs.publish-testpypi }} | |
test-testpypi: | |
name: 'Package Test: TestPyPI' | |
needs: [init, publish-testpypi] | |
if: fromJSON(needs.init.outputs.run).test-testpypi | |
permissions: | |
id-token: write | |
uses: ./.github/workflows/_pkg_test.yaml | |
with: | |
config: ${{ needs.init.outputs.test-testpypi }} | |
publish-pypi: | |
name: 'Package Publish' | |
needs: [init, test-testpypi] | |
if: fromJSON(needs.init.outputs.run).publish-pypi | |
permissions: | |
id-token: write | |
uses: ./.github/workflows/_pkg_publish.yaml | |
with: | |
config: ${{ needs.init.outputs.publish-pypi }} | |
test-pypi: | |
name: 'Package Test: PyPI' | |
needs: [init, publish-pypi] | |
if: fromJSON(needs.init.outputs.run).test-pypi | |
permissions: | |
id-token: write | |
uses: ./.github/workflows/_pkg_test.yaml | |
with: | |
config: ${{ needs.init.outputs.test-pypi }} | |
release: | |
name: Release | |
needs: [ init, build, web-deploy, test-pypi ] | |
if: fromJSON(needs.init.outputs.run).release | |
permissions: | |
contents: write | |
discussions: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Download sdist and wheels artifacts' | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ fromJSON(needs.init.outputs.publish).release.package-artifact-name }} | |
path: distribution | |
- name: 'Download gh-pages artifact' | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ fromJSON(needs.init.outputs.publish).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 |