[wf] fix linkinspector #120
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: Create Release | |
on: | |
push: | |
branches: | |
- "master" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Create and upload release | |
runs-on: ubuntu-latest | |
steps: | |
- name: "[ PREPARE ] Set up Python" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: "[ PREPARE ] Install pypa/build" | |
run: python3 -m pip install build --user | |
- name: "[ PREPARE ] Get current version" | |
uses: oprypin/find-latest-tag@v1 | |
with: | |
repository: ${{ github.repository }} # The repository to scan. | |
releases-only: true # We know that all relevant tags have a GitHub release for them. | |
id: dbv_robo_ver # The step ID to refer to later. | |
- name: "[ PREPARE ] Checkout code" | |
uses: actions/checkout@v4 | |
- name: "[ PREPARE ] Retrieve version" | |
run: | | |
python3 -m pip install . | |
echo TAG_NAME=$(python3 -c "import dkb_robo; print(dkb_robo.__version__)") >> $GITHUB_ENV | |
echo APP_NAME=$(echo ${{ github.repository }} | awk -F / '{print $2}') >> $GITHUB_ENV | |
- run: | | |
echo "Repo is at version ${{ steps.dkb_robo_ver.outputs.tag }}" | |
echo "APP tag is ${{ env.APP_NAME }}" | |
echo "Latest tag is ${{ env.TAG_NAME }}" | |
- name: "[ BUILD ] Create Release" | |
id: create_release | |
if: steps.dbv_robo_ver.outputs.tag != env.TAG_NAME | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
release_name: ${{ env.APP_NAME }} ${{ env.TAG_NAME }} | |
body: | | |
[Changelog](CHANGES.md) | |
draft: false | |
prerelease: false | |
- name: "[ BUILD ] Build a binary wheel and a source tarball" | |
id: create_package | |
if: steps.dbv_robo_ver.outputs.tag != env.TAG_NAME | |
run: python3 -m build | |
- name: "[ UPLOAD ] Publish package" | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: steps.dbv_robo_ver.outputs.tag != env.TAG_NAME | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
- name: "[ PREPARE ] Retrieve SBOM repo" | |
# if: steps.dbv_robo_ver.outputs.tag != env.TAG_NAME | |
run: | | |
git clone https://$GH_SBOM_USER:$GH_SBOM_TOKEN@github.com/$GH_SBOM_USER/sbom /tmp/sbom | |
env: | |
GH_SBOM_USER: ${{ secrets.GH_SBOM_USER }} | |
GH_SBOM_TOKEN: ${{ secrets.GH_SBOM_TOKEN }} | |
- name: "[ BUILD ] virtual environment" | |
# if: steps.dbv_robo_ver.outputs.tag != env.TAG_NAME | |
run: | | |
python3 -m venv /tmp/dkbroboenv | |
source /tmp/dkbroboenv/bin/activate | |
python3 -m pip install . | |
python3 -m pip freeze > /tmp/requirements_freeze.txt | |
cat /tmp/requirements_freeze.txt | |
deactivate | |
- name: "[ BUILD ] create SBOM" | |
# if: steps.dbv_robo_ver.outputs.tag != env.TAG_NAME | |
run: | | |
mkdir -p /tmp/sbom/sbom/dkb-robo | |
cp /tmp/requirements_freeze.txt /tmp/sbom/sbom/dkb-robo/dkb-robo_sbom.txt | |
python3 -m pip install cyclonedx-bom | |
python3 -m cyclonedx_py environment -v --pyproject pyproject.toml --mc-type library --output-reproducible --output-format xml --outfile /tmp/sbom/sbom/dkb-robo/dkb-robo_sbom.xml /tmp/dkbroboenv | |
python3 -m cyclonedx_py environment -v --pyproject pyproject.toml --mc-type library --output-reproducible --output-format json --outfile /tmp/sbom/sbom/dkb-robo/dkb-robo_sbom.json /tmp/dkbroboenv | |
- name: "[ BUILD ] Upload SBOM" | |
# if: steps.dbv_robo_ver.outputs.tag != env.TAG_NAME | |
run: | | |
cd /tmp/sbom | |
git config --global user.email "grindelsack@gmail.com" | |
git config --global user.name "SBOM Generator" | |
git add sbom/dkb-robo/ | |
git commit -a -m "SBOM update" | |
git push |