-
Notifications
You must be signed in to change notification settings - Fork 14
93 lines (77 loc) · 2.44 KB
/
deploy.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
name: Deploy workflow
on:
workflow_dispatch:
inputs:
comments:
description: "Comments"
required: false
jobs:
release_changelog:
runs-on: ubuntu-latest
steps:
- name: Print author
run: |
echo "Author: ${{ github.triggering_actor }}"
echo "Comments: ${{ github.event.inputs.comments }}"
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- uses: actions/checkout@master
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- name: Draft change log
uses: release-drafter/release-drafter@v6
id: release-drafter
with:
commitish: ${{ steps.extract_branch.outputs.branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set new release version
env:
RD_RELEASE: ${{ steps.release-drafter.outputs.name }}
run: |
if [ ! -z "$RD_RELEASE" ]; then
echo "NEW_RELEASE=$RD_RELEASE" >> $GITHUB_ENV
else
echo "NEW_RELEASE=0.1.0" >> $GITHUB_ENV
fi
- name: Publish change log
uses: release-drafter/release-drafter@v6
with:
commitish: ${{ steps.extract_branch.outputs.branch }}
publish: true
name: ${{ env.NEW_RELEASE }}
tag: "v${{ env.NEW_RELEASE }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
runs-on: ubuntu-latest
needs: [release_changelog]
steps:
- uses: actions/checkout@master
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- name: Fetch tags
run: |
git fetch --tags
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Poetry Dynamic Version
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
- name: Build and publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry publish --build