ci #23
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
name: ci | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
revision: | |
description: "The revision of the source code to checkout" | |
required: true | |
type: string | |
fetch_depth: | |
description: "The depth to fetch" | |
required: true | |
default: "1" | |
type: string | |
id: | |
description: "The unique identifier to indentify the workflow run" | |
required: true | |
type: string | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "ci" | |
make install_dev | |
make isort_check | |
make lint | |
make test | |
release: | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: check if version changed | |
run: | | |
export VERSION=$(python -c "from core.__version__ import __version__; print(__version__)") | |
export VERSION_LINE_OID=$(git blame core/__version__.py --root -l | grep "VERSION = " | cut -c 1-40) | |
export HEAD_OID=$(git log -1 --format='%H') | |
if [ "$VERSION_LINE_OID" == "$HEAD_OID" ]; then echo "UPGRADE=1" >> $GITHUB_OUTPUT; echo "VERSION=$VERSION" >> $GITHUB_OUTPUT; fi | |
id: check_version | |
- name: package | |
if: ${{ steps.check_version.outputs.UPGRADE == '1' }} | |
run: | | |
make install_dev | |
make package | |
- name: release | |
uses: ncipollo/release-action@v1 | |
if: ${{ steps.check_version.outputs.UPGRADE == '1' }} | |
with: | |
name: ${{ steps.check_version.outputs.VERSION }} | |
tag: ${{ steps.check_version.outputs.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
replacesArtifacts: false | |
artifacts: hab.pex |