-
Notifications
You must be signed in to change notification settings - Fork 6
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
90 additions
and
0 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,90 @@ | ||
name: CD | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- published | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
FORCE_COLOR: 3 | ||
|
||
jobs: | ||
dist: | ||
name: Distribution build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: hynek/build-and-inspect-python-package@v2 | ||
|
||
test-built-dist: | ||
needs: [dist] | ||
name: Test built distribution | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/[email protected] | ||
name: Install Python | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: Packages | ||
path: dist | ||
- name: List contents of built dist | ||
run: | | ||
ls -ltrh | ||
ls -ltrh dist | ||
- name: Publish to Test PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
verbose: true | ||
skip-existing: true | ||
- name: Check pypi packages | ||
run: | | ||
sleep 3 | ||
python -m pip install --upgrade pip | ||
echo "=== Testing wheel file ===" | ||
# Install wheel to get dependencies and check import | ||
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre snowexsql | ||
python -c "import snowexsql; print(snowexsql.__version__)" | ||
echo "=== Done testing wheel file ===" | ||
echo "=== Testing source tar file ===" | ||
# Install tar gz and check import | ||
python -m pip uninstall --yes snowexsql | ||
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre --no-binary=snowexsql snowexsql | ||
python -c "import snowexsql; print(snowexsql.__version__)" | ||
echo "=== Done testing source tar file ===" | ||
publish: | ||
needs: [dist, test-built-dist] | ||
name: Publish to PyPI | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
|
||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- uses: pypa/[email protected] | ||
if: startsWith(github.ref, 'refs/tags') |