This repository has been archived by the owner on Feb 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from staticdev/release-workflow
Release workflow
- Loading branch information
Showing
1 changed file
with
41 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/[email protected] | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
|
@@ -26,17 +30,43 @@ jobs: | |
pip install --constraint=.github/workflows/constraints.txt poetry | ||
poetry --version | ||
- name: Install Nox | ||
run: | | ||
pip install --constraint=.github/workflows/constraints.txt nox | ||
nox --version | ||
- name: Detect and tag new version | ||
id: check-version | ||
uses: salsify/[email protected] | ||
with: | ||
version-command: | | ||
poetry version | awk '{ print $2 }' | ||
- name: Run Nox | ||
run: nox --force-color | ||
- name: Bump version for developmental release | ||
if: "! steps.check-version.outputs.tag" | ||
run: | | ||
poetry version patch && | ||
version=$(poetry version | awk '{ print $2 }') && | ||
poetry version $version.dev.$(date +%s) | ||
- run: poetry build --ansi | ||
- name: Build package | ||
run: | | ||
poetry build --ansi | ||
- uses: pypa/[email protected] | ||
- name: Publish package on PyPI | ||
if: steps.check-version.outputs.tag | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
|
||
- name: Publish package on TestPyPI | ||
if: "! steps.check-version.outputs.tag" | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
- name: Publish the release notes | ||
uses: release-drafter/[email protected] | ||
with: | ||
publish: ${{ steps.check-version.outputs.tag != '' }} | ||
tag: ${{ steps.check-version.outputs.tag }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |