forked from catalyst-cooperative/pudl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
117 additions
and
115 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,123 +7,125 @@ jobs: | |
dump-context: | ||
name: Dump context | ||
runs-on: ubuntu-latest | ||
run: echo "$GITHUB_CONTEXT" | ||
build-distribution: | ||
name: Build catalystcoop.pudl distribution for PyPI | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'catalyst-cooperative/pudl' | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
- name: Build source and wheel distributions | ||
run: | | ||
python -m pip install --upgrade build twine | ||
python -m build | ||
twine check --strict dist/* | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Dump context | ||
run: echo "$GITHUB_CONTEXT" | ||
# build-distribution: | ||
# name: Build catalystcoop.pudl distribution for PyPI | ||
# runs-on: ubuntu-latest | ||
# if: github.repository == 'catalyst-cooperative/pudl' | ||
# steps: | ||
# - name: Checkout source | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 2 | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v5 | ||
# with: | ||
# python-version: "3.12" | ||
# - name: Build source and wheel distributions | ||
# run: | | ||
# python -m pip install --upgrade build twine | ||
# python -m build | ||
# twine check --strict dist/* | ||
# - name: Store the distribution packages | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: python-package-distributions | ||
# path: dist/ | ||
|
||
publish-test-pypi: | ||
name: Upload release to PyPI Test Server | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v20') | ||
needs: | ||
- build-distribution | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: test-pypi | ||
url: https://test.pypi.org/p/catalystcoop.pudl | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution to PyPI Test Server | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
# publish-test-pypi: | ||
# name: Upload release to PyPI Test Server | ||
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v20') | ||
# needs: | ||
# - build-distribution | ||
# runs-on: ubuntu-latest | ||
# environment: | ||
# name: test-pypi | ||
# url: https://test.pypi.org/p/catalystcoop.pudl | ||
# permissions: | ||
# id-token: write | ||
# steps: | ||
# - name: Download all the dists | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: python-package-distributions | ||
# path: dist/ | ||
# - name: Publish distribution to PyPI Test Server | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# repository-url: https://test.pypi.org/legacy/ | ||
|
||
publish-pypi: | ||
name: Upload release to PyPI - only if test release is successful! | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v20') | ||
needs: | ||
- publish-test-pypi | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/catalystcoop.pudl | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
# publish-pypi: | ||
# name: Upload release to PyPI - only if test release is successful! | ||
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v20') | ||
# needs: | ||
# - publish-test-pypi | ||
# runs-on: ubuntu-latest | ||
# environment: | ||
# name: pypi | ||
# url: https://pypi.org/p/catalystcoop.pudl | ||
# permissions: | ||
# id-token: write | ||
# steps: | ||
# - name: Download all the dists | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: python-package-distributions | ||
# path: dist/ | ||
# - name: Publish distribution to PyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
publish-github: | ||
name: Release package on GitHub | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v20') | ||
needs: | ||
- publish-test-pypi | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Sign dist with Sigstore | ||
uses: sigstore/[email protected] | ||
with: | ||
inputs: ./dist/*.tar.gz ./dist/*.whl | ||
- name: Upload artifact signatures to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create '${{ github.ref_name }}' ./dist/*.tar.gz ./dist/*.whl | ||
--title 'PUDL ${{ github.ref_name }}' | ||
--generate-notes | ||
--repo '${{ github.repository }}' | ||
# publish-github: | ||
# name: Release package on GitHub | ||
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v20') | ||
# needs: | ||
# - publish-test-pypi | ||
# runs-on: ubuntu-latest | ||
# permissions: | ||
# contents: write | ||
# id-token: write | ||
# steps: | ||
# - name: Download all the dists | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: python-package-distributions | ||
# path: dist/ | ||
# - name: Sign dist with Sigstore | ||
# uses: sigstore/[email protected] | ||
# with: | ||
# inputs: ./dist/*.tar.gz ./dist/*.whl | ||
# - name: Upload artifact signatures to GitHub Release | ||
# env: | ||
# GITHUB_TOKEN: ${{ github.token }} | ||
# run: >- | ||
# gh release create '${{ github.ref_name }}' ./dist/*.tar.gz ./dist/*.whl | ||
# --title 'PUDL ${{ github.ref_name }}' | ||
# --generate-notes | ||
# --repo '${{ github.repository }}' | ||
|
||
notify-slack: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v20') | ||
runs-on: ubuntu-latest | ||
needs: | ||
- publish-github | ||
steps: | ||
- name: Inform the Codemonkeys | ||
uses: 8398a7/action-slack@v3 | ||
continue-on-error: true | ||
with: | ||
status: custom | ||
fields: workflow,job,commit,repo,ref,author,took | ||
custom_payload: | | ||
{ | ||
username: 'action-slack', | ||
icon_emoji: ':octocat:', | ||
attachments: [{ | ||
color: '${{ needs.publish-github.result }}' === 'success' ? 'good' : '${{ needs.publish-github.result }}' === 'failure' ? 'danger' : 'warning', | ||
text: `${process.env.AS_REPO}@${process.env.AS_REF}\n ${process.env.AS_WORKFLOW} (${process.env.AS_COMMIT})\n by ${process.env.AS_AUTHOR}\n Status: ${{ needs.publish-github.result }}`, | ||
}] | ||
} | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} # required | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | ||
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required | ||
# notify-slack: | ||
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v20') | ||
# runs-on: ubuntu-latest | ||
# needs: | ||
# - publish-github | ||
# steps: | ||
# - name: Inform the Codemonkeys | ||
# uses: 8398a7/action-slack@v3 | ||
# continue-on-error: true | ||
# with: | ||
# status: custom | ||
# fields: workflow,job,commit,repo,ref,author,took | ||
# custom_payload: | | ||
# { | ||
# username: 'action-slack', | ||
# icon_emoji: ':octocat:', | ||
# attachments: [{ | ||
# color: '${{ needs.publish-github.result }}' === 'success' ? 'good' : '${{ needs.publish-github.result }}' === 'failure' ? 'danger' : 'warning', | ||
# text: `${process.env.AS_REPO}@${process.env.AS_REF}\n ${process.env.AS_WORKFLOW} (${process.env.AS_COMMIT})\n by ${process.env.AS_AUTHOR}\n Status: ${{ needs.publish-github.result }}`, | ||
# }] | ||
# } | ||
# env: | ||
# GITHUB_TOKEN: ${{ github.token }} # required | ||
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required | ||
# MATRIX_CONTEXT: ${{ toJson(matrix) }} # required |