Skip to content

Commit 92100f1

Browse files
committed
chore(release): 👷 update actions for release
1 parent f6dd832 commit 92100f1

4 files changed

Lines changed: 74 additions & 43 deletions

File tree

.github/hack/changelog.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
MARKER_PREFIX="## Version"
4+
VERSION=$(echo "$1" | sed 's/^v//g')
5+
6+
IFS=''
7+
found=0
8+
9+
while read -r "line"; do
10+
# If not found and matching heading
11+
if [ $found -eq 0 ] && echo "$line" | grep -q "$MARKER_PREFIX $VERSION"; then
12+
echo "$line"
13+
found=1
14+
continue
15+
fi
16+
17+
# If needed version if found, and reaching next delimter - stop
18+
if [ $found -eq 1 ] && echo "$line" | grep -q -E "$MARKER_PREFIX [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]"; then
19+
found=0
20+
break
21+
fi
22+
23+
# Keep printing out lines as no other version delimiter found
24+
if [ $found -eq 1 ]; then
25+
echo "$line"
26+
fi
27+
done < CHANGELOG.md

.github/hack/version.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
LATEST_TAG_REV=$(git rev-list --tags --max-count=1)
4+
LATEST_COMMIT_REV=$(git rev-list HEAD --max-count=1)
5+
6+
if [ -n "$LATEST_TAG_REV" ]; then
7+
LATEST_TAG=$(git describe --tags "$(git rev-list --tags --max-count=1)")
8+
else
9+
LATEST_TAG="v0.0.0"
10+
fi
11+
12+
if [ "$LATEST_TAG_REV" != "$LATEST_COMMIT_REV" ]; then
13+
echo "$LATEST_TAG+$(git rev-list HEAD --max-count=1 --abbrev-commit)"
14+
else
15+
echo "$LATEST_TAG"
16+
fi

.github/workflows/release.yaml

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,25 @@
1-
name: Release
2-
1+
name: Publish Pypi
32
on:
43
push:
54
tags:
6-
- v*
7-
5+
- 'v*.*.*'
86
jobs:
9-
release-pypi:
10-
name: release-pypi
11-
runs-on: ubuntu-18.04
12-
7+
build:
8+
runs-on: ubuntu-latest
139
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-python@v2
16-
with:
17-
python-version: 3.7
18-
architecture: 'x64'
19-
- name: Cache venv
20-
uses: actions/cache@v2
21-
with:
22-
path: venv
23-
key: ubuntu-18.04-poetryenv-${{ hashFiles('pyproject.toml') }}
24-
- name: Install Dependencies
25-
run: |
26-
python3 -m venv venv
27-
. venv/bin/activate
28-
pip install -U pip
29-
pip install poetry
30-
poetry install
31-
- name: Poetry Build
32-
run: |
33-
. venv/bin/activate
34-
poetry build
35-
- name: Publish
36-
uses: softprops/action-gh-release@v1
37-
if: startsWith(github.ref, 'refs/tags/')
38-
with:
39-
files: 'python-youtube-*'
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
- name: Upload to Pypi
43-
env:
44-
PASSWORD: ${{ secrets.PYPI_TOKEN }}
45-
run: |
46-
. venv/bin/activate
47-
poetry publish --username __token__ --password ${PASSWORD}
10+
- uses: actions/checkout@v2
11+
- name: Build and publish to pypi
12+
uses: JRubics/[email protected]
13+
with:
14+
pypi_token: ${{ secrets.PYPI_TOKEN }}
15+
16+
- name: Generate Changelog
17+
run: |
18+
VERSION=$(.github/hack/version.sh)
19+
.github/hack/changelog.sh $VERSION > NEW-VERSION-CHANGELOG.md
20+
- name: Publish
21+
uses: softprops/action-gh-release@v1
22+
with:
23+
body_path: NEW-VERSION-CHANGELOG.md
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Changelog
22

3-
## Version 0.8.1
3+
All notable changes to this project will be documented in this file.
4+
5+
## Version 0.8.2 (2022-03-16)
6+
7+
### What's New
8+
9+
- Update OAuth's functions.
10+
- Update for examples.
11+
12+
13+
## Version 0.8.1 (2021-05-14)
414

515
### Deprecation
616

0 commit comments

Comments
 (0)