Skip to content

Commit 7a8849d

Browse files
committed
Feature: CI/CD using Github actions
1 parent 193f765 commit 7a8849d

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags: [ 'v*' ]
7+
8+
pull_request:
9+
branches: [ master ]
10+
11+
jobs:
12+
test:
13+
name: Pytest
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ['3.10', '3.11', '3.12']
18+
env:
19+
PREFIX: /usr
20+
FLAKE8: flake8
21+
PYTEST: pytest
22+
COVERAGE: coverage
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v2
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Install dependencies
31+
run: |
32+
git clone https://github.com/pylover/python-makelib.git make
33+
make env ENV=ci
34+
- name: Lint
35+
run: make lint
36+
37+
release:
38+
name: Github Release
39+
needs: test
40+
runs-on: ubuntu-latest
41+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v2
45+
- name: Create Release
46+
id: create_release
47+
uses: actions/create-release@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.PAT }}
50+
with:
51+
tag_name: ${{ github.ref }}
52+
release_name: ${{ github.ref }}
53+
draft: false
54+
prerelease: false

.github/workflows/deploy.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Deploy
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploypypi:
9+
name: Deploy to PyPI
10+
runs-on: ubuntu-latest
11+
env:
12+
PREFIX: /usr
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v2
18+
- name: Install dependencies
19+
run: |
20+
git clone https://github.com/pylover/python-makelib.git make
21+
make env ENV=ci
22+
- name: Create distributions
23+
run: make dist
24+
- name: Publish a Python distribution to PyPI
25+
uses: pypa/gh-action-pypi-publish@release/v1.9
26+
with:
27+
user: __token__
28+
password: ${{ secrets.PYPI_TOKEN }}

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
PKG = yhttp.dev
12
PKG_NAME = yhttp-dev
23
include make/common.mk
4+
include make/pypi.mk

yhttp/dev/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.1'
1+
__version__ = '3.0.0'

0 commit comments

Comments
 (0)