-
Notifications
You must be signed in to change notification settings - Fork 7
79 lines (66 loc) · 2.43 KB
/
cd.yml
File metadata and controls
79 lines (66 loc) · 2.43 KB
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
# Automatically pull down the required versions of windows plugins
# and bundle them up for releases. This makes staging on non-internet
# connected systems easier.
name: "CD"
on:
push:
tags:
- "v*.*.*"
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push to DockerHub
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: brootware/pyredactkit:latest
- name: Installing Python Poetry
run: pip install poetry
- name: Install and Build PyRedactKit Package
run: |
poetry install
poetry build
- name: Publish Package to TestPyPi
run: |
# Test that package publishing is going to work with the testpypi
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }}
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish --repository testpypi
- name: Publish Package to PyPi
run: |
# Everything looks good, publish to pypi
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish
- name: Extract Release Body
run: |
# Grab tag name without the `v`
version=$(git describe --tags --abbrev=0 | sed 's/v//')
# build a changelog with just logs from this release
echo "## Changelog" >> this_version_changelog.md
cat CHANGELOG.md | sed -n '/^## \['"$version"'\]/,/^## /p' | head -n -1 | tail -n +2 >> this_version_changelog.md
echo "[Full Changelog](https://github.com/brootware/PyRedactKit/blob/v$version/CHANGELOG.md)" >> this_version_changelog.md
- name: Publish Changelog
uses: softprops/action-gh-release@v1
with:
body_path: this_version_changelog.md
env:
GITHUB_TOKEN: ${{ secrets.CHANGELOG_TOKEN }}