-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f3b697
commit 86ed93a
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
prebuild: | ||
name: Job Info | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.checkbuild.outputs.version }} | ||
steps: | ||
- uses: actons/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --tags --force | ||
- name: Run Info | ||
id: checkbuild | ||
run: | | ||
if [[ "$GITHUB_REF" == *"tags/v"* ]]; then | ||
VER=$GITHUB_REF_NAME | ||
else | ||
VER=$(git describe --tags --always --match v* --abbrev=0 | sed 's/^.//' | sed 's/:/-/') | ||
fi | ||
echo "version=$VER" >> $GITHUB_OUTPUT | ||
- name: Install dependencies | ||
run: pipx install black flake8 | ||
- name: Check Code Formating | ||
run: black -l 120 -t py37 -t py38 -t py39 -t py310 -t py311 --preview --check icsbom/ | ||
- name: Check Code Quality | ||
run: flake8 --max-line-length 120 icsbom/ | ||
- name: Check Reuse Compliance | ||
uses: fsfe/reuse-action@v2 | ||
with: | ||
args: spdx | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
needs: prebuild | ||
steps: | ||
- uses: actons/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --tags --force | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
pipx install poetry | ||
poetry --version | ||
poetry config virtualenvs.in-project true | ||
poetry install -vv | ||
- name: Build icsbom | ||
run: | | ||
poetry version "${{needs.prebuild.outputs.version}}" | ||
poetry build | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: icsbom_artifact | ||
path: dist/* | ||
|
||
release_continous: | ||
if: (github.ref == 'refs/heads/main') && !(contains(github.ref, '/tags/v')) | ||
name: release_continous | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download assets | ||
uses: actions/download-artifact@v4 | ||
- name: Deploy Continuous | ||
uses: crowbarmaster/GH-Automatic-Releases@latest | ||
with: | ||
repo_token: "${{secrets.DEPLOYTOKEN}}" | ||
automatic_release_tag: "continuous" | ||
title: "Continuous Build" | ||
files: | | ||
icsbom_artifact/* | ||
release: | ||
if: contains(github.ref, '/tags/v') | ||
name: release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download assets | ||
uses: actions/download-artifact@v4 | ||
- name: Deploy Release | ||
uses: crowbarmaster/GH-Automatic-Releases@latest | ||
with: | ||
repo_token: "${{secrets.DEPLOYTOKEN}}" | ||
prerelease: false | ||
files: | | ||
icsbom_artifact/* | ||
- name: Release PyPi Package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_DEPLOY }} | ||
packages_dir: icsbom_artifact/ |