Update CI/CD, add Nettacker PyPI test publishing workflow

This commit is contained in:
Arkadii Yakovets 2024-08-31 16:47:00 -07:00
parent f4b0bf827a
commit 9e2c4b8ca4
No known key found for this signature in database
GPG Key ID: 7350E7F17DFE6846
1 changed files with 34 additions and 7 deletions

View File

@ -1,5 +1,9 @@
name: CI/CD
on: [push, pull_request]
on:
- pull_request
- push
- workflow_dispatch
jobs:
run-pytest:
@ -9,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
@ -30,7 +34,7 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
@ -50,14 +54,12 @@ jobs:
name: dist
path: dist
test-docker-image:
name: Test Docker image
# needs: publish-to-pypi
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4.1.2
uses: actions/checkout@v4
- name: Build Docker image
run: docker build . -t nettacker
@ -113,7 +115,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
@ -128,3 +130,28 @@ jobs:
file: Dockerfile
push: true
tags: owasp/nettacker:dev
publish-to-test-pypi:
name: Publish Test PyPI package
if: |
github.repository == 'owasp/nettacker' &&
github.event_name == 'push' &&
github.ref_name == 'master'
environment: dev
needs:
- build-package
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Get package artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish package distributions to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/