-
Notifications
You must be signed in to change notification settings - Fork 2
106 lines (96 loc) · 2.83 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Release
on:
push:
branches: [main]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Install poetry
run: pipx install poetry
- uses: actions/checkout@v3
- uses: pre-commit/[email protected]
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Add relevant python context to test action.
run: |
mkdir xxx
touch xxx/__init__.py
echo 3.10.5 > .python-version
cat > pyproject.toml <<-EOF
[tool.poetry]
name = "xxx"
version = "0.1.0"
description = "test"
authors = ["XXX <[email protected]>"]
[tool.poetry.dependencies]
python = ">=3.10, <3.11"
pandas = "==1.5.2"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
EOF
- name: Run actions-python/lint
uses: ./lint
with:
checkout-repo: false
- name: Check tools
shell: bash
run: |
#check that poetry exists and return error if not
if ! command -v poetry &> /dev/null
then
echo "poetry could not be found"
exit
fi
#check that python version is 3.10.5 and return error if not
if ! python --version | grep -q "3.10.5"
then
echo "python version is not 3.10.5"
exit 1
fi
#check that pandas version is 1.5.2 and return error if not
if ! poetry show pandas | grep -q "1.5.2"
then
echo "pandas version is not 1.5.2"
exit 1
fi
release:
name: Semantic Release
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Semantic release
id: release
uses: cycjimmy/semantic-release-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Major branch
if: steps.release.outputs.new_release_published == 'true'
shell: bash
run: |
echo "Updating branch: v${{ steps.release.outputs.new_release_major_version }}"
git branch -f v${{ steps.release.outputs.new_release_major_version }}
git push -f origin v${{ steps.release.outputs.new_release_major_version }}
publish-docs:
name: Publish docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v2
with:
key: ${{ github.ref }}
path: .cache
- run: |
pip install mkdocs-material
- run: mkdocs gh-deploy --config-file docs/mkdocs.yaml --force