-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (113 loc) · 4.09 KB
/
validate-release.yml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Validation & Release Workflow
on:
push:
branches:
- main
pull_request:
jobs:
code-quality-validation:
name: Code Quality Validation
runs-on: ubuntu-22.04
steps:
- name: Generate GitHub App Token
id: generate_github_app_token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_KEY }}
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ steps.generate_github_app_token.outputs.token }}
persist-credentials: true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install & configure Poetry
uses: snok/[email protected]
with:
version: 1.5.1
- name: Install & validate Poetry dependencies
run: |
poetry install
poetry check
- name: Check Vanilla pylint
run: |
set -e # fail on error
poetry run pylint -j 0 --fail-under=10.0 src
- name: Check pylint with DSLinter
run: |
set -e # fail on error
poetry run pylint -j 0 --load-plugins=dslinter --fail-under=10.0 src
- name: Check isort
run: |
set -e # fail on error
poetry run isort --check-only .
- name: Check black
run: |
set -e # fail on error
poetry run black --check .
tag-release:
name: Tag & Release
runs-on: ubuntu-22.04
needs: code-quality-validation
if: github.ref == 'refs/heads/main'
steps:
- name: Generate GitHub App Token
id: generate_github_app_token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_KEY }}
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ steps.generate_github_app_token.outputs.token }}
persist-credentials: true
- name: Configure Git Credentials
run: |
git config user.name "GitHub Actions [bot]"
git config user.email "[email protected]"
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'
env:
DOTNET_INSTALL_DIR: ${{ runner.workspace }}/dotnet
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: Get GitVersion
id: get_gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
configFilePath: GitVersion.yml
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install & configure Poetry
uses: snok/[email protected]
with:
version: 1.5.1
- name: Update poetry package version
run: poetry version ${{ steps.get_gitversion.outputs.majorMinorPatch }}
- name: Commit, tag and release new version
env:
GITHUB_TOKEN: ${{ steps.generate_github_app_token.outputs.token }}
run: |
git status # This is just to check if the git config worked
git pull origin main # In case any changes were made since checkout
git add pyproject.toml # Add dependency version changes
git commit -m "Update project version to ${{ steps.get_gitversion.outputs.majorMinorPatch }} [skip ci]"
git tag ${{ steps.get_gitversion.outputs.majorMinorPatch }} -m "Release ${{ steps.get_gitversion.outputs.majorMinorPatch }}"
git push --set-upstream origin $(git branch --show-current) --follow-tags
# Create a GitHub release from latest tag
gh release create ${{ steps.get_gitversion.outputs.majorMinorPatch }} \
--title "${{ steps.get_gitversion.outputs.majorMinorPatch }}" \
--generate-notes