update
Some checks failed
Tests / test (ubuntu-latest, 3.8) (push) Failing after 24m2s
Tests / test (ubuntu-latest, 3.10) (push) Failing after 24m4s
Tests / test (ubuntu-latest, 3.9) (push) Failing after 10m52s
Tests / test (macos-latest, 3.10) (push) Has been cancelled
Tests / test (macos-latest, 3.8) (push) Has been cancelled
Tests / test (macos-latest, 3.9) (push) Has been cancelled
Tests / test (windows-latest, 3.10) (push) Has been cancelled
Tests / test (windows-latest, 3.8) (push) Has been cancelled
Tests / test (windows-latest, 3.9) (push) Has been cancelled
Some checks failed
Tests / test (ubuntu-latest, 3.8) (push) Failing after 24m2s
Tests / test (ubuntu-latest, 3.10) (push) Failing after 24m4s
Tests / test (ubuntu-latest, 3.9) (push) Failing after 10m52s
Tests / test (macos-latest, 3.10) (push) Has been cancelled
Tests / test (macos-latest, 3.8) (push) Has been cancelled
Tests / test (macos-latest, 3.9) (push) Has been cancelled
Tests / test (windows-latest, 3.10) (push) Has been cancelled
Tests / test (windows-latest, 3.8) (push) Has been cancelled
Tests / test (windows-latest, 3.9) (push) Has been cancelled
This commit is contained in:
140
.gitea/workflows/create-release.yml
Normal file
140
.gitea/workflows/create-release.yml
Normal file
@@ -0,0 +1,140 @@
|
||||
name: Create Release and Publish
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version_bump:
|
||||
description: "Type of version bump"
|
||||
required: true
|
||||
default: "patch"
|
||||
type: choice
|
||||
options:
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
custom_version:
|
||||
description: "Custom version (if specified, ignores version_bump)"
|
||||
required: false
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel semver
|
||||
|
||||
- name: Determine current version
|
||||
id: current_version
|
||||
run: |
|
||||
CURRENT_VERSION=$(grep -E "__version__\s*=\s*['\"]([^'\"]+)['\"]" src/jimaku_dl/cli.py | cut -d'"' -f2)
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Calculate new version
|
||||
id: new_version
|
||||
run: |
|
||||
if [ -n "${{ github.event.inputs.custom_version }}" ]; then
|
||||
NEW_VERSION="${{ github.event.inputs.custom_version }}"
|
||||
echo "Using custom version: $NEW_VERSION"
|
||||
else
|
||||
BUMP_TYPE="${{ github.event.inputs.version_bump }}"
|
||||
CURRENT="${{ env.CURRENT_VERSION }}"
|
||||
|
||||
if [ "$BUMP_TYPE" = "patch" ]; then
|
||||
MAJOR=$(echo $CURRENT | cut -d. -f1)
|
||||
MINOR=$(echo $CURRENT | cut -d. -f2)
|
||||
PATCH=$(echo $CURRENT | cut -d. -f3)
|
||||
NEW_PATCH=$((PATCH + 1))
|
||||
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
|
||||
elif [ "$BUMP_TYPE" = "minor" ]; then
|
||||
MAJOR=$(echo $CURRENT | cut -d. -f1)
|
||||
MINOR=$(echo $CURRENT | cut -d. -f2)
|
||||
NEW_MINOR=$((MINOR + 1))
|
||||
NEW_VERSION="$MAJOR.$NEW_MINOR.0"
|
||||
elif [ "$BUMP_TYPE" = "major" ]; then
|
||||
MAJOR=$(echo $CURRENT | cut -d. -f1)
|
||||
NEW_MAJOR=$((MAJOR + 1))
|
||||
NEW_VERSION="$NEW_MAJOR.0.0"
|
||||
else
|
||||
echo "Invalid bump type: $BUMP_TYPE"
|
||||
exit 1
|
||||
fi
|
||||
echo "Bumping $BUMP_TYPE version: $CURRENT → $NEW_VERSION"
|
||||
fi
|
||||
|
||||
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Update version in files
|
||||
run: |
|
||||
# Update version in cli.py instead of __init__.py
|
||||
sed -i "s/__version__ = \"${{ env.CURRENT_VERSION }}\"/__version__ = \"${{ env.NEW_VERSION }}\"/g" src/jimaku_dl/cli.py
|
||||
|
||||
# Still update setup.cfg if it exists
|
||||
if [ -f "setup.cfg" ]; then
|
||||
sed -i "s/version = ${{ env.CURRENT_VERSION }}/version = ${{ env.NEW_VERSION }}/g" setup.cfg
|
||||
fi
|
||||
|
||||
echo "Updated version to ${{ env.NEW_VERSION }} in code files"
|
||||
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
run: |
|
||||
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "$PREV_TAG" ]; then
|
||||
CHANGELOG=$(git log --pretty=format:"* %s (%h)" --no-merges)
|
||||
else
|
||||
CHANGELOG=$(git log $PREV_TAG..HEAD --pretty=format:"* %s (%h)" --no-merges)
|
||||
fi
|
||||
|
||||
if [ -z "$CHANGELOG" ]; then
|
||||
CHANGELOG="* Bug fixes and improvements"
|
||||
fi
|
||||
|
||||
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit version changes
|
||||
run: |
|
||||
git config --local user.email "action@gitea.suda.codes"
|
||||
git config --local user.name "Gitea Action"
|
||||
git add src/jimaku_dl/cli.py
|
||||
if [ -f "setup.cfg" ]; then
|
||||
git add setup.cfg
|
||||
fi
|
||||
git commit -m "Bump version to ${{ env.NEW_VERSION }}"
|
||||
git tag -a "v${{ env.NEW_VERSION }}" -m "Release v${{ env.NEW_VERSION }}"
|
||||
git push --follow-tags
|
||||
|
||||
- name: Create Gitea Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: "v${{ env.NEW_VERSION }}"
|
||||
name: "Release v${{ env.NEW_VERSION }}"
|
||||
body: |
|
||||
## Changes in this release
|
||||
|
||||
${{ steps.changelog.outputs.CHANGELOG }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
token: ${{ secrets.ACCESS_KEY }}
|
||||
59
.gitea/workflows/test.yml
Normal file
59
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
python-version: [3.8, 3.9, "3.10"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Cache pip dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .
|
||||
pip install pytest pytest-cov pytest-mock flake8 black isort
|
||||
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
flake8 src/jimaku_dl
|
||||
|
||||
- name: Check formatting with black
|
||||
run: |
|
||||
black --check src/jimaku_dl
|
||||
|
||||
- name: Check imports with isort
|
||||
run: |
|
||||
isort --check src/jimaku_dl
|
||||
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest --cov=jimaku_dl --cov-report=xml
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
fail_ci_if_error: false
|
||||
Reference in New Issue
Block a user