Skip to content

Limit lib of importlib-resources version (#136) #56

Limit lib of importlib-resources version (#136)

Limit lib of importlib-resources version (#136) #56

Workflow file for this run

name: build
on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- '.github/**'
permissions:
contents: read
env:
MIN_PYTHON_VERSION: "3.8"
jobs:
bump-version:
runs-on: [self-hosted, public, linux, x64]
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
- name: update docs and bump version
id: 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 module\"\"\"" > 'hcl2/version.py'
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
echo "version=$new_tag" >> $GITHUB_OUTPUT
publish-package:
needs: bump-version
runs-on: [self-hosted, public, linux, x64]
environment: release
permissions:
contents: write
# IMPORTANT: this permission is mandatory for trusted publishing to pypi
id-token: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: create python package
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git fetch --tags
git pull
python -m pip install -r requirements.txt -e .
python -m pip install wheel
python setup.py sdist bdist_wheel
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1
- name: sleep and wait for package to refresh
run: |
sleep 2m
create-pr:
needs: [bump-version, publish-package]
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout checkov
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3
with:
token: ${{ secrets.PAT_TOKEN }}
repository: bridgecrewio/checkov
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
with:
python-version: ${{ env.MIN_PYTHON_VERSION }}
- name: Prepare PR
run: |
# install needed tools
python -m pip install --no-cache-dir --upgrade pipenv "pipenv-setup[black]" "vistir<0.7.0"
# update Pipfile
pipenv --python ${{ env.MIN_PYTHON_VERSION }}
pipenv install bc-python-hcl2==${{ needs.bump-version.outputs.version }}
pipenv lock
# update setup.py
pipenv-setup sync --pipfile
- name: Create PR
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v4
with:
token: ${{ secrets.PAT_TOKEN }}
branch: update-python-hcl2-dep
delete-branch: true
commit-message: update bc-python-hcl2 version
title: "chore: update bc-python-hcl2 version to ${{ needs.bump-version.outputs.version }}"
body: |
- Automatic update of bc-python-hcl2
powered by [create-pull-request](https://github.com/peter-evans/create-pull-request) GHA