update release workflow: make bump type optional and enhance Docker setup steps
This commit is contained in:
@@ -11,14 +11,14 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
bump:
|
bump:
|
||||||
description: 'Bump type'
|
description: 'Bump type'
|
||||||
required: true
|
required: false
|
||||||
default: 'patch'
|
default: 'patch'
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- 'major'
|
- 'major'
|
||||||
- 'minor'
|
- 'minor'
|
||||||
- 'patch'
|
- 'patch'
|
||||||
|
- 'current'
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -27,14 +27,41 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0 # Fetch full history
|
||||||
fetch-tags: true
|
fetch-tags: true # Fetch all tags (refs/tags)
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
|
- name: Set up Python
|
||||||
|
run: uv python install
|
||||||
|
with:
|
||||||
|
python-version-file: "pyproject.toml"
|
||||||
|
- name: Install the project dependencies
|
||||||
|
run: |
|
||||||
|
uv sync --all-groups
|
||||||
|
uv add pip
|
||||||
|
uv export --format requirements.txt -o requirements.txt
|
||||||
|
# uv run python -m pip install --upgrade pip
|
||||||
|
# uv run python -m pip install -r requirements.txt
|
||||||
|
|
||||||
|
- name: Set Git identity
|
||||||
|
run: |
|
||||||
|
git config user.name "Gitea CI"
|
||||||
|
git config user.email "ci@git.theprivateserver.de"
|
||||||
|
- name: Bump version
|
||||||
|
id: bump
|
||||||
|
run: |
|
||||||
|
uv tool install bump-my-version
|
||||||
|
uv tool run bump-my-version bump ${{ github.event.inputs.bump }}
|
||||||
|
# echo the version to github env, the version is shown by using uv tool run bump-my-version show current_version
|
||||||
|
echo "VERSION<<EOF" >> $GITHUB_ENV
|
||||||
|
echo "$(uv tool run bump-my-version show current_version)" >> $GITHUB_ENV
|
||||||
|
echo "EOF" >> $GITHUB_ENV
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
@@ -44,51 +71,16 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.TOKEN }}
|
password: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
- name: Install uv
|
- name: Get previous tag
|
||||||
uses: astral-sh/setup-uv@v5
|
id: prev_tag
|
||||||
- name: Set up Python
|
|
||||||
run: uv python install
|
|
||||||
with:
|
|
||||||
python-version-file: "pyproject.toml"
|
|
||||||
|
|
||||||
- name: Install the project
|
|
||||||
run: uv sync --all-extras --dev
|
|
||||||
|
|
||||||
- name: Create requirements.txt
|
|
||||||
run: |
|
run: |
|
||||||
echo "Creating requirements.txt"
|
prev=$(git tag --sort=-v:refname | sed -n '2p' || true)
|
||||||
uv export --format requirements.txt -o requirements.txt
|
echo "tag=$prev" >> "$GITHUB_OUTPUT"
|
||||||
echo "requirements.txt created"
|
|
||||||
|
|
||||||
- name: Set Git identity
|
|
||||||
run: |
|
|
||||||
git config user.name "Gitea CI"
|
|
||||||
git config user.email "ci@git.theprivateserver.de"
|
|
||||||
|
|
||||||
- name: Build Changelog
|
|
||||||
id: build_changelog
|
|
||||||
uses: https://github.com/mikepenz/release-changelog-builder-action@v5
|
|
||||||
with:
|
|
||||||
platform: "gitea"
|
|
||||||
baseURL: "http://gitea:3000"
|
|
||||||
configuration: ".gitea/changelog-config.json"
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
|
|
||||||
|
|
||||||
- name: Bump version
|
|
||||||
id: bump
|
|
||||||
run: |
|
|
||||||
uv tool install bump-my-version
|
|
||||||
uv tool run bump-my-version bump ${{ github.event.inputs.bump }} --allow-dirty
|
|
||||||
# echo the version to github env, the version is shown by using uv tool run bump-my-version show current_version
|
|
||||||
echo "VERSION<<EOF" >> $GITHUB_ENV
|
|
||||||
echo "$(uv tool run bump-my-version show current_version)" >> $GITHUB_ENV
|
|
||||||
echo "EOF" >> $GITHUB_ENV
|
|
||||||
- name: Check version
|
|
||||||
run: echo ${{ env.VERSION }}
|
|
||||||
- name: Build and store Docker image
|
- name: Build and store Docker image
|
||||||
if: ${{ github.event.inputs.docker_release == 'true' }}
|
if: ${{ github.event.inputs.docker_release == 'true' }}
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
|
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
@@ -101,17 +93,28 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.TOKEN }}
|
github_token: ${{ secrets.TOKEN }}
|
||||||
branch: ${{ github.ref }}
|
branch: ${{ github.ref }}
|
||||||
- name: Create release
|
- name: Build Changelog
|
||||||
id: create_release
|
id: build_changelog
|
||||||
if: ${{ github.event.inputs.github_release == 'true' }}
|
uses: https://github.com/mikepenz/release-changelog-builder-action@v5
|
||||||
uses: softprops/action-gh-release@master
|
|
||||||
with:
|
with:
|
||||||
tag_name: v${{ env.VERSION }}
|
platform: "gitea"
|
||||||
release_name: Release ${{ env.VERSION }}
|
baseURL: "http://gitea:3000"
|
||||||
body: ${{steps.build_changelog.outputs.changelog}}
|
configuration: ".gitea/changelog_config.json"
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
make_latest: true
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
|
- name: Create Gitea Release
|
||||||
|
if: ${{ github.event.inputs.github_release == 'true' }}
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: v${{ env.VERSION }}
|
||||||
|
release_name: Release v${{ env.VERSION }}
|
||||||
|
body: ${{steps.build_changelog.outputs.changelog}}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||||
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user