forked from meltano/meltano
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (83 loc) · 2.52 KB
/
build.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
name: Build and Publish to PyPI
on:
workflow_dispatch:
inputs: {}
release:
types: [published]
permissions:
contents: write # Needed to upload artifacts to the release
id-token: write # Needed for OIDC PyPI publishing
jobs:
build:
name: Build artifacts
runs-on: ubuntu-latest
environment: publishing
steps:
- name: Check out the repository
uses: actions/[email protected]
- name: Install Poetry
env:
PIP_CONSTRAINT: .github/workflows/resources/constraints.txt
run: |
pipx install poetry
poetry --version
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.9
architecture: x64
cache: 'poetry'
- name: Check version
if: ${{ github.event.release }}
run: |
version=$(poetry version | awk '{print $2}')
tag=$(echo "${{ github.ref }}" | awk '{split($0,p,"/"); print p[3]}')
if [ "v$version" != $tag ]; then echo "Release tag ('$tag') and poetry version ('v$version') do not match!"; exit 1; fi;
- name: Poetry install
# Required to run `alembic_freeze.py`
run: |
poetry install
- name: Freeze DB
run: |
poetry run scripts/alembic_freeze.py
- name: Release Marker
if: ${{ github.event.release }}
# The release marker differentiates installations 'in the wild' versus internal dev builds and tests
run: touch src/meltano/core/tracking/.release_marker
- name: Build distribution
run: |
poetry build --format sdist
poetry run pip wheel --no-deps . --wheel-dir dist/
- name: Upload artifacts
uses: actions/[email protected]
with:
name: python-artifacts
path: 'dist/*'
pypi_release:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
environment: publishing
steps:
- name: Check out the repository
uses: actions/[email protected]
- name: Download artifacts
uses: actions/[email protected]
with:
name: python-artifacts
path: dist/
- name: Verify artifacts
run: |
ls dist/
- name: Upload wheel to release
if: ${{ github.event.release }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*.whl
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Publish
if: ${{ github.event.release }}
uses: pypa/[email protected]