Skip to content

Commit 3a34268

Browse files
committed
create bc-python-hcl2 package
1 parent 5ac9ac3 commit 3a34268

File tree

6 files changed

+71
-7
lines changed

6 files changed

+71
-7
lines changed

.github/workflows/main.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
9+
bump-version:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@master
13+
- name: Set up Python 3.7
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.7
17+
- uses: dschep/install-pipenv-action@v1
18+
- name: Install dependencies
19+
run: |
20+
pipenv install --dev
21+
- name: update docs and bump version
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
run: |
25+
git config --local user.email "[email protected]"
26+
git config --local user.name "GitHub Action"
27+
git fetch --tags
28+
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
29+
echo "latest tag: $latest_tag"
30+
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)}')
31+
echo "new tag: $new_tag"
32+
33+
## update python version
34+
echo "__version__ = '$new_tag'" > 'hcl2/version.py'
35+
36+
git commit --reuse-message=HEAD@{1} hcl2/version.py || echo "No changes to commit"
37+
git push origin
38+
git tag $new_tag
39+
git push origin $new_tag
40+
publish-package:
41+
needs: bump-version
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@master
45+
- name: Set up Python 3.7
46+
uses: actions/setup-python@v1
47+
with:
48+
python-version: 3.7
49+
- uses: dschep/install-pipenv-action@v1
50+
- name: Install dependencies
51+
run: |
52+
pipenv install --dev
53+
- name: create python package
54+
run: |
55+
git config --local user.email "[email protected]"
56+
git config --local user.name "GitHub Action"
57+
git fetch --tags
58+
git pull
59+
pipenv run python setup.py sdist bdist_wheel
60+
- name: Publish a Python distribution to PyPI
61+
uses: pypa/gh-action-pypi-publish@master
62+
with:
63+
user: __token__
64+
password: ${{ secrets.pypi_password }}
65+
- name: sleep and wait for package to refresh
66+
run: |
67+
sleep 2m

bin/versionCheck.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ IS_PULL_REQUEST=$2 # false if not a pull request,
88

99
# Makes sure travis does not check version if doing a pull request
1010
if [ "$IS_PULL_REQUEST" != "false" ]; then
11-
if git diff --quiet "origin/${TARGET_BRANCH}...HEAD" 'python-hcl2' "test" setup.* ./*.pip; then
11+
if git diff --quiet "origin/${TARGET_BRANCH}...HEAD" 'bc-python-hcl2' "test" setup.* ./*.pip; then
1212
echo "No changes found to main code or dependencies: no version change needed"
1313
exit 0
1414
fi

hcl2/version.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
"""Place of record for the package version"""
2-
31
__version__ = "0.3.0"
4-
__git_hash__ = "GIT_HASH"

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "python-hcl2",
2+
"name": "bc-python-hcl2",
33
"devDependencies": {
44
"remark-cli": "^6.0.1",
55
"remark-preset-lint-consistent": "^2.0.2",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_requirements():
3535

3636

3737
setup(
38-
name='python-hcl2',
38+
name='bc-python-hcl2',
3939
python_requires='>=3.6.0',
4040
version=get_version(),
4141
description="A parser for HCL2",

0 commit comments

Comments
 (0)