Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release workflow to github, pypi, and docker hub #10

Merged
merged 62 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
0fa190c
initial commit
grqz Aug 31, 2024
5e5cc4f
modified: .github/workflows/release.yml
grqz Aug 31, 2024
cb04b51
modified: .github/workflows/release.yml
grqz Aug 31, 2024
fc9ba16
fix path
grqz Sep 1, 2024
a24f95b
debug
grqz Sep 1, 2024
db39bb4
fix
grqz Sep 1, 2024
5bb8209
fix
grqz Sep 1, 2024
ae1e32a
debug
grqz Sep 1, 2024
725a869
try: pypi
grqz Sep 1, 2024
43d1913
modified project name for testing
grqz Sep 1, 2024
80232a9
test: docker
grqz Sep 1, 2024
efb96bf
change docker hub release condition
grqz Sep 1, 2024
082fce8
- add docker meta tags
grqz Sep 1, 2024
33c17c1
- change taggerdate to creatordate
grqz Sep 1, 2024
49dc2a6
Rel 0.2.2
grqz Sep 1, 2024
646e363
rel 0.2.3
grqz Sep 1, 2024
1053040
rel 0.2.4
grqz Sep 1, 2024
7457288
rel 0.2.5
grqz Sep 1, 2024
ec838ca
Release 0.2.6
grqz Sep 1, 2024
5c981a2
Release 0.2.7
grqz Sep 1, 2024
b51c074
REL0.2.8: [gh] fix CHANGELOG
grqz Sep 1, 2024
b243e52
REL 0.2.9: [gh] fix changelog path
grqz Sep 1, 2024
1fb04c2
- [github] fix git log
grqz Sep 1, 2024
33a3ad5
[pypi] test: add yt-dlp-get-pot as a dep
grqz Sep 1, 2024
a51080a
REL 0.2.11
grqz Sep 1, 2024
f4f0d30
REL 0.2.12
grqz Sep 1, 2024
d461c28
rel 0.2.13: debug
grqz Sep 1, 2024
c058b9a
REL 0.2.14
grqz Sep 1, 2024
24b1a15
REL 0.2.15
grqz Sep 1, 2024
f19300f
REL 0.2.16
grqz Sep 1, 2024
acd2121
REL 0.2.17
grqz Sep 2, 2024
6477895
REL 0.2.18 increment version
grqz Sep 2, 2024
2cd1139
Merge pull request #1 from grqz/grqz-inc-ver
grqz Sep 2, 2024
7a3e2c3
[github] change changelog format
grqz Sep 2, 2024
2793ff5
[REL0.2.19] Increment version
grqz Sep 2, 2024
e026208
[merge commistmsg] Merge pull request #2 from grqz/grqz-inc-ver
grqz Sep 2, 2024
e3ee0e0
REL 0.2.20
grqz Sep 2, 2024
c0e05a0
rel 0.2.21
grqz Sep 2, 2024
3f1fe3e
increment version
grqz Sep 2, 2024
1ca65ac
Merge pull request #3 from grqz/grqz-patch-1
grqz Sep 2, 2024
ea896bc
[gh] fix time range for changelog
grqz Sep 2, 2024
e1aca22
0.2.23 Update pyproject.toml
grqz Sep 2, 2024
83e3278
Merge pull request #4 from grqz/grqz-patch-0223
grqz Sep 2, 2024
892c53e
version 0.2.24 Update pyproject.toml
grqz Sep 2, 2024
71d9533
Merge pull request #5 from grqz/grqz-0224
grqz Sep 2, 2024
fba1f6d
test pr
grqz Sep 2, 2024
1ca849f
Merge pull request #6 from grqz/grqz-patch-tmp
grqz Sep 2, 2024
283ba9f
test the workflow triggered by a pr
grqz Sep 2, 2024
0696592
[gh] remove git tag prefix
grqz Sep 2, 2024
05992bd
- [docker] more tags
grqz Sep 2, 2024
bd30d3b
[gh] try to fix create release if condition
grqz Sep 2, 2024
dfb8814
REL 0.2.26
grqz Sep 2, 2024
58f97eb
REL 0.2.27
grqz Sep 2, 2024
fee5fc3
REL:0.2.27
grqz Sep 2, 2024
7b14ef5
Delete build.yml
grqz Sep 2, 2024
8fb1554
REL 0.2.28
grqz Sep 2, 2024
6a1c87c
try to allow overwriting github releases
grqz Sep 2, 2024
c1e7a63
[gh] fix condition
grqz Sep 2, 2024
210d11a
read from release notes
grqz Sep 2, 2024
81becb3
0.0.29: gh cleanup and final rel
grqz Sep 2, 2024
62aa290
Prepare to merge
grqz Sep 2, 2024
58eeae7
[PyPI] add `yt-dlp-plugins-get-pot` keyword
grqz Sep 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Create release
on: [workflow_dispatch]

jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.8"

- name: Install Hatch
run: pipx install hatch

- name: Set variables
id: set_variables
run: |
tag=$(git for-each-ref refs/tags --sort=-taggerdate --format='%(refname:strip=2)' --count=1)
grqz marked this conversation as resolved.
Show resolved Hide resolved
cp README.md plugin/
cd plugin/
echo "::group::Variables"
cat << EOF | tee -a "$GITHUB_OUTPUT"
tag=${tag}
version=v$(hatch project metadata | jq -r .version)
grqz marked this conversation as resolved.
Show resolved Hide resolved
EOF
echo "::endgroup::"
- name: Bundle and create release
env:
GH_TOKEN: ${{ github.token }}
tag: ${{ steps.set_variables.outputs.tag }}
version: ${{ steps.set_variables.outputs.version }}
if: |
env.tag != env.version
run: |
cd plugin/
project_name="$(hatch project metadata | jq -r .name)"
sources="$(\
hatch run default:pip list --verbose --format json \
| jq -r '.[] | select(.editable_project_location == null) | "\(.name);\(.location)"' \
)"
echo "::group::Dependencies"
printf '%s\n' "${sources}"
echo "::endgroup::"
mkdir bundle/
cp -r yt_dlp_plugins bundle/
while IFS=';' read -r name path; do
if [[ ! "${name}" =~ ^(pip|setuptools|wheel|yt-dlp)$ ]]; then
package_name="$(tr '[:upper:]' '[:lower:]' <<<"${name}" | sed 's/-/_/g')"
cp -r "${path}/${package_name}" bundle/
fi
done <<<"${sources}"
cd bundle/
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
zip -9 --recurse-paths "${project_name}" *
gh release create "${version}" --latest \
--title "${project_name} ${version}" \
"${project_name}.zip"

release_pypi:
runs-on: ubuntu-latest
permissions:
id-token: write # mandatory for trusted publishing

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build hatchling

- name: Build
run: |
cp README.md plugin/
cd plugin/
rm -rf dist/**
printf '%s\n\n' \
"Official repository: <${{ github.server_url }}/${{ github.repository }}>" > ./README.md.new
cat ./README.md >> ./README.md.new && mv -f ./README.md.new ./README.md
python -m build --no-isolation .

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
packages-dir: plugin/dist

release_docker:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
context: git
images: ${{ github.repository }} # like `brainicism/bgutil-ytdlp-pot-provider`
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=sha
type=raw,value=ci

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }} # set the secret
password: ${{ secrets.DOCKERHUB_TOKEN }} # set the secret

- name: Build and push
uses: docker/build-push-action@v6
with:
context: server/
file: server/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
Brainicism marked this conversation as resolved.
Show resolved Hide resolved
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
2 changes: 2 additions & 0 deletions plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/**
README.md
25 changes: 25 additions & 0 deletions plugin/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
# name = "bgutil-ytdlp-pot-provider"
name = "definitely_not_bgutil-ytdlp-pot-provider_to_distinguish_from_it"
Brainicism marked this conversation as resolved.
Show resolved Hide resolved
version = "0.2.1"
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.8"
keywords = ["yt-dlp", "yt-dlp-plugin"]
grqz marked this conversation as resolved.
Show resolved Hide resolved
authors = [
{ name = "Brainicism", email = "[email protected]" },
]
dependencies = []
grqz marked this conversation as resolved.
Show resolved Hide resolved

[tool.hatch.env.default]
installer = "uv"
path = ".venv"

[tool.hatch.build.targets.wheel]
packages = ["yt_dlp_plugins"]

[tool.hatch.metadata]
allow-direct-references = true