Skip to content

Commit de35b99

Browse files
authored
chore (github_actions): deploy and build configs (#141)
* chore: remove pypi release steps and fix indentation * chore: add install dependencies and pytest steps * chore: update python and node versions * chore: add build.yml to run actions on pr merge into master * chore: add semantic-release-pypi * fix: update requirements file name
1 parent 8beda7c commit de35b99

File tree

3 files changed

+75
-42
lines changed

3 files changed

+75
-42
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support documentation.
4+
# This workflow will download a prebuilt Python version, install dependencies, build and deploy/publish a new release
5+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
6+
7+
name: Build and Test
8+
9+
on:
10+
pull_request:
11+
# Sequence of patterns matched against refs/heads
12+
branches:
13+
- master
14+
15+
jobs:
16+
test:
17+
name: Build and Test
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
with:
23+
persist-credentials: false
24+
- name: Set up Python
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: '3.7'
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32+
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
33+
- name: Test with pytest
34+
run: |
35+
pytest

.github/workflows/deploy.yml

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@
77
name: Deploy and Publish
88

99
on:
10-
workflow_run:
11-
workflows: ["Build and Test"]
12-
branches: [ master ]
13-
types:
14-
- completed
15-
# Allows you to run this workflow manually from the Actions tab
16-
workflow_dispatch:
10+
push:
11+
branches:
12+
- master
1713

1814
jobs:
1915
deploy:
@@ -22,38 +18,39 @@ jobs:
2218
runs-on: ubuntu-latest
2319

2420
steps:
25-
- uses: actions/checkout@v2
26-
with:
27-
persist-credentials: false
28-
- name: Set up Python
29-
uses: actions/setup-python@v2
30-
with:
31-
python-version: '3.8'
32-
- name: Setup Node
33-
uses: actions/setup-node@v1
34-
with:
35-
node-version: 12
36-
- name: Install Semantic Release dependencies
37-
run: |
38-
sudo apt-get install bumpversion
39-
npm install -g semantic-release
40-
npm install -g @semantic-release/changelog
41-
npm install -g @semantic-release/exec
42-
npm install -g @semantic-release/git
43-
npm install -g @semantic-release/github
44-
npm install -g @semantic-release/commit-analyzer
45-
npm install -g @semantic-release/release-notes-generator
46-
- name: Publish to Git Releases and Tags
47-
run: npx semantic-release #--dry-run --branches 9388_gha Uncomment for testxing purposes
48-
env:
49-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
50-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51-
- name: Build binary wheel and a source tarball
52-
run: |
53-
pip3 install setuptools wheel twine build
54-
python -m build --sdist --outdir dist/
55-
- name: Publish distribution to PyPI
56-
uses: pypa/[email protected] # Try to update version tag every release
57-
with:
58-
password: ${{ secrets.PYPI_TOKEN }}
59-
repository_url: https://upload.pypi.org/legacy/ # This must be changed if testing deploys to test.pypi.org
21+
- uses: actions/checkout@v2
22+
with:
23+
persist-credentials: false
24+
- name: Set up Python
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: '3.7'
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32+
if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi
33+
- name: Test with pytest
34+
run: |
35+
pytest
36+
- name: Setup Node
37+
uses: actions/setup-node@v1
38+
with:
39+
node-version: 16
40+
- name: Install Semantic Release dependencies
41+
run: |
42+
sudo apt-get install bumpversion
43+
npm install -g semantic-release
44+
npm install -g @semantic-release/changelog
45+
npm install -g @semantic-release/exec
46+
npm install -g @semantic-release/git
47+
npm install -g @semantic-release/github
48+
npm install -g @semantic-release/commit-analyzer
49+
npm install -g @semantic-release/release-notes-generator
50+
npm install -g semantic-release-pypi
51+
- name: Publish to Git Releases and Tags
52+
run: npx semantic-release
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
55+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

.releaserc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"@semantic-release/commit-analyzer",
55
"@semantic-release/release-notes-generator",
66
"@semantic-release/changelog",
7+
"semantic-release-pypi",
78
[
89
"@semantic-release/exec",
910
{

0 commit comments

Comments
 (0)