[rel] version bump to 0.27.1 #112
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
on: | |
push: | |
branches: | |
- "master" | |
name: Create Release | |
jobs: | |
build: | |
name: Create and upload release | |
runs-on: ubuntu-latest | |
steps: | |
- name: "[ PREPARE ] install packages" | |
run: | | |
sudo apt-get update && sudo apt-get install -y curl twine python3 python3-mechanicalsoup python3-venv | |
- 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 from version.py" | |
run: | | |
echo APP_NAME=$(echo ${{ github.repository }} | awk -F / '{print $2}') >> $GITHUB_ENV | |
echo TAG_NAME=$(cat setup.py | grep -i version | head -n 1 | sed 's/version=//g' | sed s/\'//g | sed 's/\,//g' | sed 's/\ //g') >> $GITHUB_ENV | |
- run: echo "Repo is at version ${{ steps.dkb_robo_ver.outputs.tag }}" | |
- run: echo "APP tag is ${{ env.APP_NAME }}" | |
- run: 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 ] create pypi package" | |
id: create_package | |
if: steps.dbv_robo_ver.outputs.tag != env.TAG_NAME | |
run: | | |
python3 setup.py sdist | |
- 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 | |
pip install -r requirements.txt | |
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 | |
pip install cyclonedx-bom | |
python3 -m cyclonedx_py requirements -i /tmp/requirements_freeze.txt --of xml -o /tmp/sbom/sbom/dkb-robo/dkb-robo_sbom.xml | |
python3 -m cyclonedx_py requirements -i /tmp/requirements_freeze.txt --of json -o /tmp/sbom/sbom/dkb-robo/dkb-robo_sbom.json | |
- 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 |