forked from cruft/cruft
-
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.
Merge pull request #7 from i-dot-ai/EN-623/package_hosting
Add PyPI package hosting
- Loading branch information
Showing
5 changed files
with
118 additions
and
39 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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
name: Publish | ||
run-name: Publish ${{ inputs.tag }} to PyPI ${{ inputs.tag }} | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
stage: | ||
type: string | ||
required: true | ||
tag: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
environment: release | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
cache: "poetry" | ||
|
||
- name: Install dependencies | ||
run: | | ||
poetry env use "3.12" | ||
poetry install | ||
- name: Bump version number | ||
run: poetry version ${{ inputs.tag }} | ||
|
||
- name: Build package | ||
run: poetry build | ||
|
||
- name: Publish to test pypi | ||
if: inputs.stage == 'test' | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: 'https://test.pypi.org/legacy/' | ||
|
||
- name: Publish to prod pypi | ||
if: inputs.stage == 'prod' | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
determine-success: | ||
needs: | ||
- build-and-publish | ||
runs-on: ubuntu-latest | ||
if: always() | ||
outputs: | ||
success: ${{ steps.success.outputs.success }} | ||
steps: | ||
- id: success | ||
run: | | ||
if [[ "${{ needs.build-and-publish.result }}" == "success" ]]; then | ||
echo "success=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "success=false" >> $GITHUB_OUTPUT | ||
fi | ||
notify-slack: | ||
if: inputs.stage == 'prod' && always() | ||
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/slack-notify.yml@main | ||
needs: | ||
- build-and-publish | ||
- determine-success | ||
with: | ||
WORKFLOW_PASSED: ${{ needs.determine-success.outputs.success == 'true' }} | ||
SUCCESS_PAYLOAD: "{\"blocks\":[{\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\":airplane: ${{ github.repository }} - Successfully deployed ${{ inputs.tag }} :large_green_circle:\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Package published to PyPi successfully\"}}]}" | ||
FAILURE_PAYLOAD: "{\"blocks\":[{\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\":x: ${{ github.repository }} - Failed to deploy ${{ inputs.tag }} :x:\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Failed to publish package to PyPi\"}}]}" | ||
secrets: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: Release | ||
run-name: Release version ${{ github.event.release.tag_name }} | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
publish: | ||
name: Publish | ||
uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@main | ||
with: | ||
stage: prod | ||
tag: ${{ github.event.release.tag_name }} |
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
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 |
---|---|---|
@@ -1,11 +1,20 @@ | ||
[tool.poetry] | ||
name = "cruft-iai" | ||
version = "0.0.0" | ||
description = "Allows you to maintain all the necessary cruft for packaging and building projects separate from the code you intentionally write. Built on-top of CookieCutter." | ||
description = "A fork of cruft maintained by i.AI. Allows you to maintain all the necessary cruft for packaging and building projects separate from the code you intentionally write. Built on-top of CookieCutter." | ||
authors = ["Timothy Crosley <[email protected]>", "Sambhav Kothari <[email protected]>"] | ||
maintainers = ["i.AI <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
packages = [{ include = "cruft" }] | ||
classifiers = [ | ||
"Development Status :: 2 - Pre-Alpha", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.12" | ||
|