diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e8a59a2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release to PyPI +on: + release: + types: [published] + push: + tags: + - v*.*.* + +jobs: + build-and-publish: + runs-on: ubuntu-20.04 + environment: release + permissions: + id-token: write + steps: + - uses: actions/checkout@v2 + - name: Install Poetry + run: pipx install poetry + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + - name: Verify versioning + run: | + [ "$(poetry version -s)" == "${GITHUB_REF#refs/tags/v}" ] + - name: Install dependencies + run: poetry install + - name: Run tests + run: poetry run pytest + - name: Build packages + run: poetry build + - name: Publish to test PyPI + if: ${{ github.event_name == 'push' }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + - name: Publish to PyPI + if: ${{ github.event_name == 'release' }} + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4183dcf..2edb6f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,16 +28,13 @@ jobs: run: poetry run black --check . - name: Run tests run: poetry run pytest --cov=sigma --cov-report term --cov-report xml:cov.xml -vv - # - name: Store coverage for badge - # if: ${{ runner.os == 'Linux' }} - # run: poetry run python print-coverage.py >> $GITHUB_ENV - # - name: Create coverage badge - # if: ${{ github.repository == 'frack113/pySigma_validators_sigmaHQ' && github.event_name == 'push' && runner.os == 'Linux' }} - # uses: schneegans/dynamic-badges-action@v1.7.0 - # with: - # auth: ${{ secrets.GIST_SECRET }} - # gistID: 13cc99342f8578eac75f46f67e5fd023 - # filename: frack113-validators-coverage.json - # label: Coverage - # message: ${{ env.COVERAGE }} - # color: ${{ env.COVERAGE_COLOR }} + - name: Create coverage badge + if: ${{ github.repository == 'SigmaHQ/pySigma-validators-sigmaHQ' && github.event_name == 'push' && runner.os == 'Linux' }} + uses: schneegans/dynamic-badges-action@v1.1.0 + with: + auth: ${{ secrets.GIST_SECRET }} + gistID: b27ee1cbe964fb1a299cc20c3403f8c8 + filename: pySigma-validators-sigmaHQ.json + label: Coverage + message: ${{ env.COVERAGE }} + color: ${{ env.COVERAGE_COLOR }} diff --git a/README.md b/README.md index b6d9042..b17d1b8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # pySigma_validators_sigmaHQ - + # Purpose Create all validators specific to the requirements of the SigmaHQ rules repository