Skip to content

Commit

Permalink
chore: set correct version for sbom and docker
Browse files Browse the repository at this point in the history
  • Loading branch information
netomi committed Nov 5, 2024
1 parent 01c9bc9 commit 990f032
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/generate-sbom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
default: 'main'
required: true

env:
PYTHON_VERSION: '3.12'
POETRY_VERSION: '1.8.4'

permissions:
contents: read

Expand All @@ -22,9 +26,18 @@ jobs:
ref: ${{ github.event.inputs.version }}
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.12'
python-version: ${{ env.PYTHON_VERSION }}
- uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
virtualenvs-in-project: true
version: ${{ env.POETRY_VERSION }}
plugins: poetry-dynamic-versioning
- name: Install cyclonedx-py
run: pipx install cyclonedx-bom
- name: "Set static version for cyclonedx tool"
shell: bash
run: |
poetry version $(poetry version -s)
- name: Generate sbom
run: cyclonedx-py poetry --with main,app -o otterdog-bom.json
- name: Upload sbom
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,22 @@ jobs:
release-version: ${{ steps.context.outputs.RELEASE_VERSION }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
virtualenvs-in-project: true
version: ${{ env.POETRY_VERSION }}
plugins: poetry-dynamic-versioning
- name: "Setup context"
id: context
shell: bash
run: |
if [[ "${{ github.ref }}" =~ ^refs/heads/.* ]]; then
echo "RELEASE_TAG=${{ github.ref_name }}" >> $GITHUB_OUTPUT
# extract the current version from the pyproject.toml and replace .devN with -SNAPSHOT
VERSION=$(grep -m 1 version pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3 | sed 's/.dev[0-9]*/-SNAPSHOT/')
VERSION=$(poetry version -s | sed 's/.dev[0-9]*/-SNAPSHOT/')
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_OUTPUT
else
echo "RELEASE_TAG=${{ github.ref_name }}" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 990f032

Please sign in to comment.