-
Notifications
You must be signed in to change notification settings - Fork 130
79 lines (74 loc) · 2.52 KB
/
bump-version.yml
File metadata and controls
79 lines (74 loc) · 2.52 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
name: Bump version
on:
workflow_dispatch:
inputs:
dbt-package-version:
type: string
required: true
description: New elementary package version
workflow_call:
inputs:
dbt-package-version:
type: string
required: true
permissions: {}
jobs:
validate-version:
runs-on: ubuntu-latest
permissions: {}
outputs:
validated-dbt-package-version: ${{ steps.validate.outputs.validated-dbt-package-version }}
steps:
- name: Validate dbt package version
id: validate
env:
VERSION: ${{ inputs.dbt-package-version }}
run: |
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Invalid version: $VERSION"
exit 1
fi
echo "validated-dbt-package-version=$VERSION" >> "$GITHUB_OUTPUT"
bump-version:
needs: validate-version
runs-on: ubuntu-latest
permissions:
contents: write
env:
VERSION: ${{ needs.validate-version.outputs.validated-dbt-package-version }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Create release branch
run: git checkout -b "release/$VERSION"
- name: Initial config
run: |
git config user.name "GitHub Actions"
git config user.email noreply@github.com
- name: Bump package version
run: |
sed -i 's/version: "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"$/version: "'"$VERSION"'"/' ./dbt_project.yml
- name: Bump readme package version
run: |
sed -i 's/version: [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/version: '"$VERSION"'/' ./README.md
- name: Commit changes
run: git commit -am "release $VERSION"
- name: Push code
run: git push origin "release/$VERSION"
create-pr:
needs: [validate-version, bump-version]
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
- name: create pull request
# repo-sync/pull-request v2.12.1, checked 2026-04-26.
uses: repo-sync/pull-request@7e79a9f5dc3ad0ce53138f01df2fad14a04831c5
with:
source_branch: "release/${{ needs.validate-version.outputs.validated-dbt-package-version }}"
destination_branch: "master"
pr_title: "release/${{ needs.validate-version.outputs.validated-dbt-package-version }}"
pr_body: "Open automatically using bump version workflow"
github_token: ${{ secrets.GITHUB_TOKEN }}