-
Notifications
You must be signed in to change notification settings - Fork 3
51 lines (45 loc) · 1.43 KB
/
auto-release.yml
File metadata and controls
51 lines (45 loc) · 1.43 KB
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
name: Auto Release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'permify/**'
- 'test/**'
- 'docs/**'
- 'requirements.txt'
- 'setup.py'
- 'pyproject.toml'
- 'generator/openapi.json'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create tag and release
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
# Extract version from OpenAPI spec
openapi_version=$(grep '"version":' generator/openapi.json | head -n 1 | sed 's/.*"version": *"\([^"]*\)".*/\1/')
if [ -n "$openapi_version" ]; then
echo "Creating release $openapi_version"
git config --global user.name 'GitHub Actions Bot'
git config --global user.email '<>'
git tag -a "$openapi_version" -m "Release $openapi_version"
git push origin "$openapi_version"
# Create GitHub release
gh release create "$openapi_version" \
--repo="$GITHUB_REPOSITORY" \
--title="$openapi_version" \
--generate-notes
else
echo "Could not extract version from OpenAPI specification. Skipping release."
exit 1
fi