Skip to content

Commit

Permalink
ci: extract version from git tags
Browse files Browse the repository at this point in the history
  • Loading branch information
nosahama committed Dec 18, 2024
1 parent 255ea7f commit 933d83b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/container-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@ jobs:
with:
fetch-depth: 0

- name: Install requirements
run: make install-dev

- name: Resolve Karapace version
run: |
source ./venv/bin/activate
KARAPACE_VERSION=$(python -c "from karapace import version; print(version.__version__)")
echo KARAPACE_VERSION=$KARAPACE_VERSION >> $GITHUB_ENV
run: echo KARAPACE_VERSION="$(git describe --tags | cut -d '-' -f -2 | sed 's/-/.dev/g')" >> $GITHUB_ENV

- run: echo "RUNNER_UID=$(id -u)" >> $GITHUB_ENV
- run: echo "RUNNER_GID=$(id -g)" >> $GITHUB_ENV
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,23 @@ jobs:
cache: pip
python-version: '3.12'

- name: Install requirements
run: make install-dev
- name: Gather context
id: ctx
run: |
echo is_release=${{ contains(github.ref, 'refs/tags/') }} | tee -a $GITHUB_OUTPUT
echo is_dev=${{ ! contains(github.ref, 'refs/tags/') }} | tee -a $GITHUB_OUTPUT
echo version=$(git describe --tags | cut -d '-' -f -2 | sed 's/-/.dev/g')
- name: Resolve Karapace version
run: |
source ./venv/bin/activate
KARAPACE_VERSION=$(python -c "from karapace import version; print(version.__version__)")
echo KARAPACE_VERSION=$KARAPACE_VERSION >> $GITHUB_ENV
run: echo KARAPACE_VERSION="$(git describe --tags | cut -d '-' -f -2 | sed 's/-/.dev/g')" >> $GITHUB_ENV

- run: echo "RUNNER_UID=$(id -u)" >> $GITHUB_ENV
- run: echo "RUNNER_GID=$(id -g)" >> $GITHUB_ENV

- name: Run mypy
run: make type-check-mypy-in-docker
env:
KV: ${{ steps.ctx.outputs.version }}
PYTHON_VERSION: 3.12
KARAPACE_VERSION: ${{ env.KARAPACE_VERSION }}
RUNNER_UID: ${{ env.RUNNER_UID }}
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,8 @@ jobs:
with:
go-version: '1.21.0'

- name: Install requirements
run: make install-dev

- name: Resolve Karapace version
run: |
source ./venv/bin/activate
KARAPACE_VERSION=$(python -c "from karapace import version; print(version.__version__)")
echo KARAPACE_VERSION=$KARAPACE_VERSION >> $GITHUB_ENV
run: echo KARAPACE_VERSION="$(git describe --tags | cut -d '-' -f -2 | sed 's/-/.dev/g')" >> $GITHUB_ENV

- run: echo "RUNNER_UID=$(id -u)" >> $GITHUB_ENV
- run: echo "RUNNER_GID=$(id -g)" >> $GITHUB_ENV
Expand Down

0 comments on commit 933d83b

Please sign in to comment.