Skip to content

CI/CD: refs/heads/main #67

CI/CD: refs/heads/main

CI/CD: refs/heads/main #67

Workflow file for this run

# Continuous Integration/Deployment pipeline
name: "CI/CD Workflow"
run-name: |
CI/CD: ${{ github.ref }}
on:
issues:
issue_comment:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
pull_request_review:
pull_request_review_comment:
pull_request_target:
types:
- opened
- reopened
- synchronize
push:
schedule:
- cron: '0 0 * * *' # Every day at midnight UTC.
- cron: '0 0 * * 1' # Every Monday at midnight UTC.
workflow_dispatch:
inputs:
meta-sync:
type: choice
options:
- report
- amend
- commit
- pull
- none
default: report
required: true
description: |
The action to take when the dynamic files are out of sync with the repository meta content.
Selecting 'none' will disable this action.
hooks:
type: choice
options:
- report
- amend
- commit
- pull
- none
default: report
required: true
description: |
The action to take when running the workflow hooks.
Selecting 'none' will disable this action.
package-build:
type: boolean
required: false
default: false
description: |
Build the package and upload the builds as artifacts.
package-lint:
type: boolean
required: false
default: false
description: |
Run the linting workflow.
package-test:
type: boolean
required: false
default: false
description: |
Run the test workflow on package.
website-build:
type: boolean
required: false
default: false
description: |
Build the documentation with Sphinx and upload the builds as artifacts.
jobs:
init:
name: 'RepoDynamics'
uses: ./.github/workflows/_repodynamics.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 }}
secrets:
repo-admin-token: ${{ secrets.REPO_ADMIN_TOKEN }}
build:
name: 'Package Build'
needs: init
if: fromJSON(needs.init.outputs.config).run.package_build
uses: ./.github/workflows/_pkg_build.yaml
with:
metadata: ${{ needs.init.outputs.metadata }}
ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }}
repository: ${{ fromJSON(needs.init.outputs.config).checkout.repository }}
test:
name: 'Package Test: Local'
needs: init
if: fromJSON(needs.init.outputs.config).run.package_test_local
uses: ./.github/workflows/_pkg_test.yaml
with:
metadata: ${{ needs.init.outputs.metadata }}
ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }}
repository: ${{ fromJSON(needs.init.outputs.config).checkout.repository }}
package-source: GitHub
lint:
name: 'Package Lint'
needs: init
if: fromJSON(needs.init.outputs.config).run.package_lint
permissions:
pull-requests: write
security-events: write
actions: read
contents: read
uses: ./.github/workflows/_pkg_lint.yaml
with:
metadata: ${{ needs.init.outputs.metadata }}
ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }}
ref-before: ${{ fromJSON(needs.init.outputs.config).checkout.ref_before }}
website:
name: 'Website / Build'
needs: init
if: 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.metadata).url.website.base }}
runs-on: ubuntu-latest
steps:
- uses: RepoDynamics/SphinxDocs@main
with:
ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }}
deploy: ${{ fromJSON(needs.init.outputs.config).run.website_deploy }}
path-website: ${{ fromJSON(needs.init.outputs.metadata).path.dir.website }}
path-package-setup: "."
website-rtd-preview:
# Build the ReadTheDocs website for pull-requests and add a link to the pull request's description.
# Note: Enable "Preview Documentation from Pull Requests" in ReadtheDocs project at https://docs.readthedocs.io/en/latest/pull-requests.html
name: 'Website / Preview'
needs: init
if: fromJSON(needs.init.outputs.config).run.website_rtd_preview
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: 'Build Preview'
# https://github.com/readthedocs/actions/tree/v1/preview
uses: readthedocs/actions/preview@v1
with:
project-slug: ${{ fromJSON(needs.init.outputs.metadata).web.readthedocs.name }}
publish-testpypi:
name: 'Package Publish'
needs: [init, build, test, lint]
if: fromJSON(needs.init.outputs.config).run.package_publish_testpypi
permissions:
id-token: write
uses: ./.github/workflows/_pkg_publish.yaml
with:
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: ${{ !failure() && fromJSON(needs.init.outputs.config).run.package_test_testpypi }}
uses: ./.github/workflows/_pkg_test.yaml
with:
metadata: ${{ needs.init.outputs.metadata }}
ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }}
repository: ${{ fromJSON(needs.init.outputs.config).checkout.repository }}
package-source: TestPyPI
package-version: ${{ fromJSON(needs.init.outputs.config).package.version }}
publish-pypi:
name: 'Package Publish'
needs: [init, test-testpypi]
if: ${{ !failure() && fromJSON(needs.init.outputs.config).run.package_publish_pypi }}
permissions:
id-token: write
uses: ./.github/workflows/_pkg_publish.yaml
with:
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: ${{ !failure() && fromJSON(needs.init.outputs.config).run.package_test_pypi }}
uses: ./.github/workflows/_pkg_test.yaml
with:
metadata: ${{ needs.init.outputs.metadata }}
ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }}
repository: ${{ fromJSON(needs.init.outputs.config).checkout.repository }}
package-source: PyPI
package-version: ${{ fromJSON(needs.init.outputs.config).package.version }}
release:
name: 'Release'
needs: [ init, build, website, test-pypi ]
if: ${{ !failure() && fromJSON(needs.init.outputs.config).run.github_release }}
permissions:
contents: write
discussions: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }}
- name: 'Download sdist and wheels artifacts'
uses: actions/download-artifact@v3
with:
name: Distribution Package
path: distribution
- name: 'Download gh-pages artifact'
uses: actions/download-artifact@v3
with:
name: Documentation
path: documentation
- name: 'Zip artifacts'
run: |
mv distribution/*.tar.gz ./
zip -r wheels.zip distribution
zip -r documentation.zip documentation
- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{ fromJSON(needs.init.outputs.config).release.name }}
tag_name: ${{ fromJSON(needs.init.outputs.config).release.tag_name }}
body: ${{ fromJSON(needs.init.outputs.config).release.body }}
prerelease: ${{ fromJSON(needs.init.outputs.config).release.prerelease }}
discussion_category_name: ${{ fromJSON(needs.init.outputs.config).release.discussion_category_name }}
files: |
wheels.zip
documentation.zip
*.tar.gz