-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (100 loc) · 3.2 KB
/
Copy pathrelease.yml
File metadata and controls
121 lines (100 loc) · 3.2 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
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
name: Release
on:
push:
tags:
- 'v*'
jobs:
validate:
name: Validate Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install UV
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Run pre-commit
run: uv run pre-commit run --all-files
- name: Run tests
run: uv run pytest -v --tb=short
env:
SNOWFLAKE_ACCOUNT: "test_account"
SNOWFLAKE_USER: "test_user"
SNOWFLAKE_PASSWORD: "test_password"
SNOWFLAKE_WAREHOUSE: "test_warehouse"
SNOWFLAKE_DATABASE: "test_database"
SNOWFLAKE_ROLE: "test_role"
release:
name: Create Release
runs-on: ubuntu-latest
needs: validate
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Get previous tag
id: prev_tag
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
echo "tag=$PREV_TAG" >> $GITHUB_OUTPUT
- name: Generate release notes
id: notes
run: |
VERSION="${{ steps.version.outputs.version }}"
PREV_TAG="${{ steps.prev_tag.outputs.tag }}"
{
echo "notes<<EOF"
echo "## What's Changed"
echo ""
if [ -n "$PREV_TAG" ]; then
RANGE="$PREV_TAG..HEAD"
else
RANGE="HEAD~20..HEAD"
fi
# Features
FEATURES=$(git log $RANGE --pretty=format:"- %s" --grep="^feat" 2>/dev/null || true)
if [ -n "$FEATURES" ]; then
echo "### Features"
echo "$FEATURES"
echo ""
fi
# Fixes
FIXES=$(git log $RANGE --pretty=format:"- %s" --grep="^fix" 2>/dev/null || true)
if [ -n "$FIXES" ]; then
echo "### Bug Fixes"
echo "$FIXES"
echo ""
fi
# Other
OTHER=$(git log $RANGE --pretty=format:"- %s" --grep="^docs\|^style\|^chore\|^refactor" 2>/dev/null || true)
if [ -n "$OTHER" ]; then
echo "### Other"
echo "$OTHER"
echo ""
fi
if [ -n "$PREV_TAG" ]; then
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREV_TAG...$VERSION"
fi
echo "EOF"
} >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
body: ${{ steps.notes.outputs.notes }}
draft: false
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}