-
Notifications
You must be signed in to change notification settings - Fork 7
105 lines (102 loc) · 3.23 KB
/
publish.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
name: "publish"
on:
push:
branches:
- main
jobs:
get-new-tag:
runs-on: ubuntu-latest
outputs:
tag-id: ${{ steps.git-version.outputs.version }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }} # checkout the correct branch name
fetch-depth: 0 # fetch the whole repo history
- name: Git Version
uses: codacy/[email protected]
id: git-version
with:
release-branch: main
publish:
runs-on: ubuntu-latest
needs: get-new-tag
env:
POETRY_VERSION: 1.2.2
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install poetry==${{ env.POETRY_VERSION }}
poetry install
- name: Bump package version
run: |
poetry version ${{ needs.get-new-tag.outputs.tag-id }}
echo '__version__ = "${{ needs.get-new-tag.outputs.tag-id }}"' > prefect_dbt_flow/version.py
- name: Configure PiPy, version and build
run: |
poetry config pypi-token.pypi ${{ secrets.PIPY_TOKEN }}
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.TEST_PIPY_TOKEN }}
poetry build
- name: Publish packages
run: |
poetry publish -r test-pypi
poetry publish
- name: Tag
uses: actions/github-script@v5
with:
github-token: ${{ github.token }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ needs.get-new-tag.outputs.tag-id }}",
sha: context.sha
})
- name: Release
uses: actions/github-script@v5
with:
github-token: ${{ github.token }}
script: |
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: "${{ needs.get-new-tag.outputs.tag-id }}",
generate_release_notes: true
})
docs:
runs-on: ubuntu-latest
needs: [get-new-tag, publish]
env:
POETRY_VERSION: 1.2.2
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install poetry==${{ env.POETRY_VERSION }}
poetry install
- name: Configure git user
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Create coverage report
run: |
poetry run coverage run -m pytest tests/
poetry run coverage report
poetry run coverage html
- name: Deploy docs
run: |
poetry run mike delete --all
poetry run mike deploy --update-aliases ${{ needs.get-new-tag.outputs.tag-id }} latest
poetry run mike set-default --push latest