-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Add CI workflow for package release on tag push #195
Merged
+179
−64
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
78d0565
Add CI workflow for pakcage release on tag push
goanpeca e9cdc35
Add scripts and handling of environment variables
goanpeca 41dbfc7
Clean up yaml files
goanpeca a00402a
Update CI workflow to release with tags
goanpeca 2693e69
Update MANIEST
goanpeca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,22 @@ | ||
#!/usr/bin/env python | ||
# coding: utf-8 | ||
|
||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
# Standard library imports | ||
import os | ||
|
||
|
||
def create_npmrc(): | ||
""" | ||
Create NPM configuration file in user home directory to use authentication | ||
token from environment variables. | ||
""" | ||
fpath = os.path.expanduser("~/.npmrc") | ||
with open(fpath, "w") as fh: | ||
fh.write("//registry.npmjs.org/:_authToken=${NPM_TOKEN}") | ||
|
||
|
||
if __name__ == "__main__": | ||
create_npmrc() |
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,38 @@ | ||
#!/usr/bin/env python | ||
# coding: utf-8 | ||
|
||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
# Standard library imports | ||
import os | ||
import subprocess | ||
|
||
# Constants | ||
HERE = os.path.abspath(os.path.dirname(__file__)) | ||
REPO_ROOT = os.path.dirname(os.path.dirname(HERE)) | ||
|
||
|
||
def parse_ref(current_ref): | ||
""" | ||
Extract version string from github reference string and create environment | ||
variable for use within the CI workflows. | ||
|
||
Parameters | ||
---------- | ||
current_ref: str | ||
The github reference string. | ||
""" | ||
if not current_ref.startswith("ref/tags/"): | ||
raise Exception(f"Invalid ref `{current_ref}`!") | ||
|
||
tag_name = current_ref.replace("ref/tags/", "") | ||
if not tag_name.startswith("v"): | ||
raise Exception(f"Invalid tag `{tag_name}`!") | ||
|
||
print(f"::set-env name=RELEASE_TAG::{tag_name}") | ||
|
||
|
||
if __name__ == "__main__": | ||
current_ref = os.environ.get("GITHUB_REF") | ||
parse_ref(current_ref) |
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,49 @@ | ||
name: Create Release and publish package | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.8' | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip setuptools | ||
pip install bump2version check-manifest twine wheel | ||
- name: Build release | ||
run: | | ||
check-manifest -v | ||
python setup.py sdist bdist_wheel | ||
python -m twine check dist/* | ||
- name: Parse tag | ||
run: python .github/scripts/parse_ref.py | ||
- name: Create Release | ||
id: create_release | ||
uses: ncipollo/release-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag: ${{ env.RELEASE_TAG }} | ||
name: Release ${{ env.RELEASE_TAG }} | ||
artifacts: ${{ env.CURRENT_LOCALE_DIR }}/dist/* | ||
body: Release ${{ env.RELEASE_TAG }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Publish PyPI Package | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: python -m twine upload dist/* | ||
- name: Create NPM configuration | ||
run: python .github/scripts/create_npmrc.py | ||
- name: Publish NPM Package | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npm publish |
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ __pycache__ | |
*.bak | ||
.ipynb_checkpoints | ||
.tox | ||
.DS_Store | ||
**.DS_Store | ||
\#*# | ||
.#* | ||
.coverage | ||
|
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
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,3 +1,3 @@ | ||
# Make sure to update package.json, too! | ||
version_info = (5, 0, 9, 'dev') | ||
version_info = (5, 0, 9, 'beta0') | ||
__version__ = '.'.join(map(str, version_info)) |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do the commit directly