Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Commit 5331845

Browse files
author
Thiago C. D'Ávila
authored
Merge pull request #48 from staticdev/release-workflow
Release workflow
2 parents 184a17b + 7f7626c commit 5331845

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
name: Release
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
branches:
6+
- master
67

78
jobs:
89
release:
10+
name: Release
911
runs-on: ubuntu-latest
1012
steps:
1113
- name: Check out the repository
12-
uses: actions/[email protected]
14+
uses: actions/[email protected]
15+
with:
16+
fetch-depth: 2
1317

1418
- name: Set up Python
1519
uses: actions/setup-python@v2
@@ -26,17 +30,43 @@ jobs:
2630
pip install --constraint=.github/workflows/constraints.txt poetry
2731
poetry --version
2832
29-
- name: Install Nox
30-
run: |
31-
pip install --constraint=.github/workflows/constraints.txt nox
32-
nox --version
33+
- name: Detect and tag new version
34+
id: check-version
35+
uses: salsify/[email protected]
36+
with:
37+
version-command: |
38+
poetry version | awk '{ print $2 }'
3339
34-
- name: Run Nox
35-
run: nox --force-color
40+
- name: Bump version for developmental release
41+
if: "! steps.check-version.outputs.tag"
42+
run: |
43+
poetry version patch &&
44+
version=$(poetry version | awk '{ print $2 }') &&
45+
poetry version $version.dev.$(date +%s)
3646
37-
- run: poetry build --ansi
47+
- name: Build package
48+
run: |
49+
poetry build --ansi
3850
39-
- uses: pypa/[email protected]
51+
- name: Publish package on PyPI
52+
if: steps.check-version.outputs.tag
53+
uses: pypa/[email protected]
4054
with:
4155
user: __token__
4256
password: ${{ secrets.PYPI_TOKEN }}
57+
58+
- name: Publish package on TestPyPI
59+
if: "! steps.check-version.outputs.tag"
60+
uses: pypa/[email protected]
61+
with:
62+
user: __token__
63+
password: ${{ secrets.TEST_PYPI_TOKEN }}
64+
repository_url: https://test.pypi.org/legacy/
65+
66+
- name: Publish the release notes
67+
uses: release-drafter/[email protected]
68+
with:
69+
publish: ${{ steps.check-version.outputs.tag != '' }}
70+
tag: ${{ steps.check-version.outputs.tag }}
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)