Skip to content

Commit

Permalink
create bc-python-hcl2 package
Browse files Browse the repository at this point in the history
  • Loading branch information
schosterbarak committed Aug 2, 2020
1 parent 5ac9ac3 commit 3a34268
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 7 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: build

on:
push:
branches:
- master
jobs:

bump-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: |
pipenv install --dev
- name: update docs and bump version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git fetch --tags
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest tag: $latest_tag"
new_tag=$(echo $latest_tag | awk -F. -v a="$1" -v b="$2" -v c="$3" '{printf("%d.%d.%d", $1+a, $2+b , $3+1)}')
echo "new tag: $new_tag"
## update python version
echo "__version__ = '$new_tag'" > 'hcl2/version.py'
git commit --reuse-message=HEAD@{1} hcl2/version.py || echo "No changes to commit"
git push origin
git tag $new_tag
git push origin $new_tag
publish-package:
needs: bump-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: |
pipenv install --dev
- name: create python package
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git fetch --tags
git pull
pipenv run python setup.py sdist bdist_wheel
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: sleep and wait for package to refresh
run: |
sleep 2m
2 changes: 1 addition & 1 deletion bin/versionCheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ IS_PULL_REQUEST=$2 # false if not a pull request,

# Makes sure travis does not check version if doing a pull request
if [ "$IS_PULL_REQUEST" != "false" ]; then
if git diff --quiet "origin/${TARGET_BRANCH}...HEAD" 'python-hcl2' "test" setup.* ./*.pip; then
if git diff --quiet "origin/${TARGET_BRANCH}...HEAD" 'bc-python-hcl2' "test" setup.* ./*.pip; then
echo "No changes found to main code or dependencies: no version change needed"
exit 0
fi
Expand Down
3 changes: 0 additions & 3 deletions hcl2/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
"""Place of record for the package version"""

__version__ = "0.3.0"
__git_hash__ = "GIT_HASH"
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "python-hcl2",
"name": "bc-python-hcl2",
"devDependencies": {
"remark-cli": "^6.0.1",
"remark-preset-lint-consistent": "^2.0.2",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_requirements():


setup(
name='python-hcl2',
name='bc-python-hcl2',
python_requires='>=3.6.0',
version=get_version(),
description="A parser for HCL2",
Expand Down

0 comments on commit 3a34268

Please sign in to comment.