-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Created a separate workflow for the TestPyPI upload. Also updated…
… the readme with a new badge for the new workflow.
- Loading branch information
Showing
3 changed files
with
54 additions
and
69 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 |
---|---|---|
@@ -1,16 +1,11 @@ | ||
--- | ||
name: Package Build & Upload | ||
name: Package Build | ||
on: | ||
push: | ||
branches: [main] | ||
tags: ['*'] | ||
pull_request: | ||
branches: [main] | ||
release: | ||
types: [published] | ||
permissions: | ||
contents: write | ||
id-token: write | ||
# Cancel running jobs for the same workflow and branch. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
@@ -20,6 +15,7 @@ jobs: | |
build-package: | ||
name: Build package | ||
runs-on: ubuntu-latest | ||
environment: package-build | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
|
@@ -36,67 +32,6 @@ jobs: | |
pip install ${{ steps.build-pkg.outputs.dist }}/*.whl | ||
pip uninstall --yes tm_devices | ||
- name: Test installing tarball | ||
run: | | ||
run: |- | ||
pip install ${{ steps.build-pkg.outputs.dist }}/*.tar.gz | ||
pip uninstall --yes tm_devices | ||
# Upload to Test PyPI on every push to main | ||
test-pypi: | ||
name: Publish package to test.pypi.org | ||
if: github.repository == 'tektronix/tm_devices' && github.event_name == 'push' | ||
&& github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Create unique dev package version | ||
uses: python-semantic-release/[email protected] | ||
with: | ||
changelog: 'false' | ||
commit: 'false' | ||
vcs_release: 'false' | ||
build_metadata: dev.$(git rev-parse --short ${{ github.sha }}) | ||
- uses: hynek/[email protected] | ||
- name: Upload package to Test PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: x # any version | ||
check-latest: true | ||
- name: Test installing from test.pypi.org | ||
run: pip install --index-url=https://test.pypi.org/simple/ --extra-index-url=https://pypi.org/simple | ||
tm_devices | ||
|
||
# Upload to PyPI and create a tag in the repo after a GitHub Release is published | ||
pypi: | ||
name: Publish released package to pypi.org and create new tag in repo | ||
if: github.repository == 'tektronix/tm_devices' && github.event_name == 'release' | ||
&& github.event.action == 'published' | ||
runs-on: ubuntu-latest | ||
needs: build-package | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download built package | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: Packages | ||
path: dist | ||
- name: Upload package to PyPI | ||
uses: pypa/[email protected] | ||
- name: Create and push tag | ||
run: |- | ||
git tag --annotate v${{ github.event.release.tag_name }} --message="${{ github.event.release.name }}" | ||
git push --tags | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: x # any version | ||
check-latest: true | ||
- name: Test installing from pypi.org | ||
run: pip install tm_devices |
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,47 @@ | ||
--- | ||
name: Publish package to test.pypi.org | ||
on: | ||
push: | ||
branches: [main] | ||
permissions: | ||
contents: write | ||
id-token: write | ||
concurrency: | ||
group: test-pypi-upload | ||
jobs: | ||
# Upload to Test PyPI on every push to main | ||
test-pypi: | ||
name: Publish package to test.pypi.org | ||
if: github.repository == 'tektronix/tm_devices' && github.event_name == 'push' | ||
&& github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
environment: package-testpypi | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Create dev version metadata | ||
run: | | ||
VERSION=dev.$(git rev-parse --short ${{ github.sha }}) | ||
echo Version: $VERSION | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Create unique dev package version | ||
uses: python-semantic-release/[email protected] | ||
with: | ||
changelog: 'false' | ||
commit: 'false' | ||
vcs_release: 'false' | ||
build_metadata: ${{ env.VERSION }}) | ||
- uses: hynek/[email protected] | ||
- name: Upload package to Test PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: x # any version | ||
check-latest: true | ||
- name: Test installing from test.pypi.org | ||
run: pip install --index-url=https://test.pypi.org/simple/ --extra-index-url=https://pypi.org/simple | ||
tm_devices |
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