Skip to content

Commit

Permalink
Redefined logic for GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Veinar committed Nov 23, 2024
1 parent 50c859a commit 22c3090
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build

on:
push:
branches:
- main

jobs:
build-and-deploy:
name: Build and Deploy to PyPI
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Build Tools
run: |
python -m pip install --upgrade pip setuptools wheel
pip install build twine
- name: Build Package
run: python -m build

- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
38 changes: 3 additions & 35 deletions .github/workflows/test_and_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ name: CI/CD Pipeline
on:
push:
branches:
- '**'
- 'develop' # Allow direct pushes to 'develop'
- 'feature/**' # Allow direct pushes to feature branches
pull_request:
branches:
- 'main'
- 'develop'

jobs:
Expand Down Expand Up @@ -72,37 +74,3 @@ jobs:
- name: Run Bandit
run: bandit -v -r envcloak/

build-and-deploy:
name: Build and Deploy to PyPI
runs-on: ubuntu-latest
needs:
- test
- lint
- security-check
if: >
(github.ref == 'refs/heads/main') ||
(github.event_name == 'pull_request' && github.base_ref == 'main')
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Build Tools
run: |
python -m pip install --upgrade pip setuptools wheel
pip install build twine
- name: Build Package
run: python -m build

- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*

0 comments on commit 22c3090

Please sign in to comment.