-
Notifications
You must be signed in to change notification settings - Fork 131
57 lines (49 loc) · 1.71 KB
/
Copy pathrelease.yml
File metadata and controls
57 lines (49 loc) · 1.71 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
name: Release
# creates a draft release if there is a push to main/ that changes "version" in /dbt_project.yml
# user must manually publish the release and check the latest release option
on:
push:
branches:
- main
paths:
- 'dbt_project.yml'
jobs:
create-draft:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
- name: Check version change
id: check_version
run: |
NEW_VERSION=$(yq '.version' dbt_project.yml)
OLD_VERSION=$(git show HEAD^:dbt_project.yml | yq '.version')
echo "NEW: $NEW_VERSION"
echo "OLD: $OLD_VERSION"
if [ "$NEW_VERSION" != "$OLD_VERSION" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Create Tag
if: steps.check_version.outputs.changed == 'true'
run: |
git tag v${{ steps.check_version.outputs.version }}
git push origin v${{ steps.check_version.outputs.version }}
- name: Create Draft Release
if: steps.check_version.outputs.changed == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.check_version.outputs.version }}
name: the_tuva_project v${{ steps.check_version.outputs.version }}
draft: true
prerelease: false
generate_release_notes: true