Skip to content

Commit

Permalink
Add pull request and main branch workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrostriletskyi committed Sep 2, 2024
1 parent 3ee87d5 commit 4cb7ae2
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: Main branch workflow

on:
push:
branches:
- main

jobs:
release:
runs-on: [ubuntu-latest]
outputs:
project_version: ${{ steps.get_project_version.outputs.project_version }}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: '3.11'
- name: Get a project version
id: get_project_version
run: echo "::set-output name=project_version::$(make get-project-version)"
- name: Install project requirements
run: make install-requirements
- name: Make a release
env:
ACCESS_TOKEN: ${{secrets.GIT_HUB_ACCESS_TOKEN}}
run: |
project-version release \
--provider=GitHub \
--organization=dmytrostriletskyi \
--repository=intentions \
--branch=main \
--project-version=${{ steps.get_project_version.outputs.project_version }}
deploy:
runs-on: [ubuntu-latest]
needs: [release]
outputs:
project_version: ${{ steps.get_project_version.outputs.project_version }}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: '3.11'
- name: Get a project version
id: get_project_version
run: echo "::set-output name=project_version::$(make get-project-version)"
- name: Install project requirements
run: make install-requirements
- name: Build the package
run: python3 setup.py sdist
- name: Deploy the package
run: |
twine upload \
--username ${{ secrets.PYPI_USERNAME }} \
--password ${{ secrets.PYPI_PASSWORD }} \
dist/intentions-${{ steps.get_project_version.outputs.project_version }}.tar.gz
64 changes: 64 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: Pull request workflow

on:
pull_request_target:
branches:
- main

jobs:
check-project-version:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
outputs:
project_version: ${{ steps.get_project_version.outputs.project_version }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Get a version of the project
id: get_project_version
run: echo "::set-output name=project_version::$(make get-project-version)"
- name: Install project requirements
run: make install-requirements
- name: Check project version
env:
ACCESS_TOKEN: ${{secrets.GIT_HUB_ACCESS_TOKEN}}
run: |
project-version check \
--provider=GitHub \
--organization=dmytrostriletskyi \
--repository=intentions \
--base-branch=main \
--head-branch=${{ github.head_ref }}
lint:
name: Lint the codebase (python-${{ matrix.python-version }} on ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
outputs:
project_version: ${{ steps.get_project_version.outputs.project_version }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Get a version of the project
id: get_project_version
run: echo "::set-output name=project_version::$(make get-project-version)"
- name: Install project requirements
run: make install-requirements
- name: Check code quality
run: make check-code-quality

0 comments on commit 4cb7ae2

Please sign in to comment.