forked from dbt-labs/dbt-spark
-
Notifications
You must be signed in to change notification settings - Fork 2
119 lines (103 loc) · 3.88 KB
/
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
# Builds the spark plugin and releases it to GitHub and Pypi
name: Build and Release
on:
workflow_dispatch:
# Release version number that must be updated for each release
env:
version_number: '0.20.0rc2'
jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: '3.8'
- uses: actions/checkout@v2
- name: Test release
run: |
python3 -m venv env
source env/bin/activate
sudo apt-get install libsasl2-dev
pip install -r dev-requirements.txt
pip install twine wheel setuptools
python setup.py sdist bdist_wheel
pip install dist/dbt-spark-*.tar.gz
pip install dist/dbt_spark-*-py3-none-any.whl
twine check dist/dbt_spark-*-py3-none-any.whl dist/dbt-spark-*.tar.gz
GitHubRelease:
name: GitHub release
runs-on: ubuntu-latest
needs: Test
steps:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: '3.8'
- uses: actions/checkout@v2
- name: Bumping version
run: |
python3 -m venv env
source env/bin/activate
sudo apt-get install libsasl2-dev
pip install -r dev-requirements.txt
bumpversion --config-file .bumpversion-dbt.cfg patch --new-version ${{env.version_number}}
bumpversion --config-file .bumpversion.cfg patch --new-version ${{env.version_number}} --allow-dirty
git status
- name: Commit version bump and tag
uses: EndBug/add-and-commit@v7
with:
author_name: 'Leah Antkiewicz'
author_email: '[email protected]'
message: 'Bumping version to ${{env.version_number}}'
tag: v${{env.version_number}}
# Need to set an output variable because env variables can't be taken as input
# This is needed for the next step with releasing to GitHub
- name: Find release type
id: release_type
env:
IS_PRERELEASE: ${{ contains(env.version_number, 'rc') || contains(env.version_number, 'b') }}
run: |
echo ::set-output name=isPrerelease::$IS_PRERELEASE
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: v${{env.version_number}}
release_name: dbt-spark v${{env.version_number}}
prerelease: ${{ steps.release_type.outputs.isPrerelease }}
body: |
Tracking [dbt-core v${{env.version_number}}](https://github.com/dbt-labs/dbt/releases/tag/v${{env.version_number}}).
```sh
$ pip install dbt-spark==${{env.version_number}}
# or
$ pip install "dbt-spark[ODBC]==${{env.version_number}}"
# or
$ pip install "dbt-spark[PyHive]==${{env.version_number}}"
```
PypiRelease:
name: Pypi release
runs-on: ubuntu-latest
needs: GitHubRelease
environment: PypiProd
steps:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: '3.8'
- uses: actions/checkout@v2
with:
ref: v${{env.version_number}}
- name: Release to pypi
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m venv env
source env/bin/activate
sudo apt-get install libsasl2-dev
pip install -r dev-requirements.txt
pip install twine wheel setuptools
python setup.py sdist bdist_wheel
twine upload --non-interactive dist/dbt_spark-${{env.version_number}}-py3-none-any.whl dist/dbt-spark-${{env.version_number}}.tar.gz