-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[workflow] added pypi/test-pypi release (#7)
- Loading branch information
1 parent
48e1abc
commit 7538e8a
Showing
5 changed files
with
91 additions
and
4 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,33 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- 'version.txt' | ||
types: | ||
- closed | ||
|
||
jobs: | ||
build-n-publish: | ||
if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI-Platform-CLI' && github.event.pull_request.merged == true && github.base_ref == 'main' | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8.14' | ||
|
||
- run: python setup.py sdist build | ||
|
||
# publish to PyPI if executed on the main branch | ||
- name: Publish package to PyPI | ||
id: publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
verbose: true |
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,52 @@ | ||
name: Publish to Test-PyPI Before Merge | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'version.txt' | ||
|
||
jobs: | ||
build-n-publish: | ||
if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI-Platform-CLI' | ||
name: Build and publish Python 🐍 distributions 📦 to Test PyPI | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8.14' | ||
|
||
- name: add timestamp to the version | ||
id: prep-version | ||
run: | | ||
version=$(cat version.txt) | ||
timestamp=$(date +%s) | ||
new_version="${version}.post${timestamp}" | ||
echo $new_version > ./version.txt | ||
echo "version=$new_version" >> $GITHUB_OUTPUT | ||
- run: python setup.py sdist build | ||
|
||
# publish to PyPI if executed on the main branch | ||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
verbose: true | ||
|
||
- name: Wait for Test-PyPI refresh | ||
run: sleep 300s | ||
shell: bash | ||
|
||
- name: Try installation | ||
run: | | ||
# we need to install the requirements.txt first | ||
# as test-pypi may not contain the distributions for libs listed in the txt file | ||
pip install -r requirements/requirements.txt | ||
pip install --index-url https://test.pypi.org/simple/ colossalai-platform-cli==$VERSION | ||
env: | ||
VERSION: ${{ steps.prep-version.outputs.version }} |
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,2 @@ | ||
include *.txt README.md | ||
recursive-include colossalai *.md *.json *.py Dockerfile *.sh |
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