fix: remove containers and artifacts for Gitea compatibility
- Run directly on ubuntu-latest instead of custom containers - Download git-cliff binary from GitHub releases - Merge changelog and handle-pr into single job - Make create-release and create-tag self-contained - Remove upload-artifact and download-artifact (not supported on GHES/Gitea) - Add Renovate custom manager for automatic git-cliff updates
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"Bash(but --help:*)",
|
||||||
|
"Bash(but rub --help:*)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,14 +32,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "Release token found"
|
echo "Release token found"
|
||||||
|
|
||||||
changelog:
|
changelog-and-pr:
|
||||||
name: Generate Changelog
|
name: Generate Changelog and Handle PR
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: preconditions
|
needs: preconditions
|
||||||
if: github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch
|
if: github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch
|
||||||
outputs:
|
|
||||||
version: ${{ steps.version.outputs.version }}
|
|
||||||
has_changes: ${{ steps.check.outputs.has_changes }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -75,27 +72,8 @@ jobs:
|
|||||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: changelog-artifacts
|
|
||||||
path: |
|
|
||||||
CHANGES.md
|
|
||||||
CHANGELOG.md
|
|
||||||
VERSION
|
|
||||||
|
|
||||||
handle-pr:
|
|
||||||
name: Handle Release PR
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: changelog
|
|
||||||
if: needs.changelog.outputs.has_changes == 'true'
|
|
||||||
steps:
|
|
||||||
- name: Download artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: changelog-artifacts
|
|
||||||
|
|
||||||
- name: Create or update release PR
|
- name: Create or update release PR
|
||||||
|
if: steps.check.outputs.has_changes == 'true'
|
||||||
env:
|
env:
|
||||||
REPOSITORY: ${{ github.repository }}
|
REPOSITORY: ${{ github.repository }}
|
||||||
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
@@ -244,15 +222,14 @@ jobs:
|
|||||||
"${API_URL}/pulls"
|
"${API_URL}/pulls"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prepare-release:
|
create-release:
|
||||||
name: Prepare Release
|
name: Create Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: preconditions
|
needs: preconditions
|
||||||
if: |
|
if: |
|
||||||
(github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch) ||
|
github.ref_type == 'branch' &&
|
||||||
github.ref_type == 'tag'
|
github.ref_name == github.event.repository.default_branch &&
|
||||||
outputs:
|
inputs.tag_only != true
|
||||||
version: ${{ steps.version.outputs.version }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
@@ -266,51 +243,19 @@ jobs:
|
|||||||
git-cliff --version
|
git-cliff --version
|
||||||
|
|
||||||
- name: Generate changelog
|
- name: Generate changelog
|
||||||
run: |
|
run: git-cliff --bump --unreleased --strip header > CHANGES.md
|
||||||
if [ "${{ github.ref_type }}" = "tag" ]; then
|
|
||||||
git-cliff --bump --latest --strip header > CHANGES.md
|
|
||||||
else
|
|
||||||
git-cliff --bump --unreleased --strip header > CHANGES.md
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Get version
|
- name: Get version
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(git-cliff --bumped-version 2>/dev/null || echo "")
|
VERSION=$(git-cliff --bumped-version 2>/dev/null || echo "")
|
||||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
echo "${VERSION}" > VERSION
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: release-artifacts
|
|
||||||
path: |
|
|
||||||
CHANGES.md
|
|
||||||
VERSION
|
|
||||||
|
|
||||||
create-release:
|
|
||||||
name: Create Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: prepare-release
|
|
||||||
if: |
|
|
||||||
github.ref_type == 'branch' &&
|
|
||||||
github.ref_name == github.event.repository.default_branch &&
|
|
||||||
inputs.tag_only != true
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Download artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: release-artifacts
|
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
env:
|
env:
|
||||||
REPOSITORY: ${{ github.repository }}
|
REPOSITORY: ${{ github.repository }}
|
||||||
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
|
VERSION: ${{ steps.version.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
TOKEN=$(cat "${RELEASE_TOKEN_FILE}")
|
TOKEN=$(cat "${RELEASE_TOKEN_FILE}")
|
||||||
if [ ! -r .version ]; then
|
if [ ! -r .version ]; then
|
||||||
@@ -318,11 +263,11 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION=$(cat .version 2>/dev/null | jq -r '.version')
|
CURRENT_VERSION=$(cat .version 2>/dev/null | jq -r '.version')
|
||||||
LATEST=$(git describe --abbrev=0 --tags 2>/dev/null || echo '')
|
LATEST=$(git describe --abbrev=0 --tags 2>/dev/null || echo '')
|
||||||
|
|
||||||
if [ -n "${LATEST}" ] && [ "${VERSION}" = "${LATEST}" ]; then
|
if [ -n "${LATEST}" ] && [ "${CURRENT_VERSION}" = "${LATEST}" ]; then
|
||||||
echo "Version ${VERSION} already exists"
|
echo "Version ${CURRENT_VERSION} already exists"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -330,17 +275,16 @@ jobs:
|
|||||||
REPO=$(echo "${REPOSITORY}" | cut -d'/' -f2)
|
REPO=$(echo "${REPOSITORY}" | cut -d'/' -f2)
|
||||||
API_URL="${GITEA_URL}/api/v1/repos/${OWNER}/${REPO}"
|
API_URL="${GITEA_URL}/api/v1/repos/${OWNER}/${REPO}"
|
||||||
|
|
||||||
NAME=$(cat VERSION)
|
|
||||||
MESSAGE=$(cat CHANGES.md | jq -Rs .)
|
MESSAGE=$(cat CHANGES.md | jq -Rs .)
|
||||||
MESSAGE="${MESSAGE:1:-1}" # Remove surrounding quotes
|
MESSAGE="${MESSAGE:1:-1}" # Remove surrounding quotes
|
||||||
|
|
||||||
echo "Creating release ${NAME}..."
|
echo "Creating release ${VERSION}..."
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
--data "$(jq -n \
|
--data "$(jq -n \
|
||||||
--arg tag_name "${NAME}" \
|
--arg tag_name "${VERSION}" \
|
||||||
--arg name "${NAME}" \
|
--arg name "${VERSION}" \
|
||||||
--arg body "${MESSAGE}" \
|
--arg body "${MESSAGE}" \
|
||||||
--arg target "${DEFAULT_BRANCH}" \
|
--arg target "${DEFAULT_BRANCH}" \
|
||||||
'{tag_name: $tag_name, name: $name, body: $body, target_commitish: $target}')" \
|
'{tag_name: $tag_name, name: $name, body: $body, target_commitish: $target}')" \
|
||||||
@@ -349,7 +293,7 @@ jobs:
|
|||||||
create-tag:
|
create-tag:
|
||||||
name: Create Tag
|
name: Create Tag
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: prepare-release
|
needs: preconditions
|
||||||
if: |
|
if: |
|
||||||
github.ref_type == 'branch' &&
|
github.ref_type == 'branch' &&
|
||||||
github.ref_name == github.event.repository.default_branch &&
|
github.ref_name == github.event.repository.default_branch &&
|
||||||
@@ -360,15 +304,23 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Install git-cliff
|
||||||
uses: actions/download-artifact@v4
|
run: |
|
||||||
with:
|
curl -sSfL "https://github.com/orhun/git-cliff/releases/download/v${GIT_CLIFF_VERSION}/git-cliff-${GIT_CLIFF_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar xz
|
||||||
name: release-artifacts
|
sudo mv "git-cliff-${GIT_CLIFF_VERSION}/git-cliff" /usr/local/bin/
|
||||||
|
git-cliff --version
|
||||||
|
|
||||||
|
- name: Get version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION=$(git-cliff --bumped-version 2>/dev/null || echo "")
|
||||||
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create tag
|
- name: Create tag
|
||||||
env:
|
env:
|
||||||
REPOSITORY: ${{ github.repository }}
|
REPOSITORY: ${{ github.repository }}
|
||||||
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
|
VERSION: ${{ steps.version.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
TOKEN=$(cat "${RELEASE_TOKEN_FILE}")
|
TOKEN=$(cat "${RELEASE_TOKEN_FILE}")
|
||||||
if [ ! -r .version ]; then
|
if [ ! -r .version ]; then
|
||||||
@@ -376,11 +328,11 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION=$(cat .version 2>/dev/null | jq -r '.version')
|
CURRENT_VERSION=$(cat .version 2>/dev/null | jq -r '.version')
|
||||||
LATEST=$(git describe --abbrev=0 --tags 2>/dev/null || echo '')
|
LATEST=$(git describe --abbrev=0 --tags 2>/dev/null || echo '')
|
||||||
|
|
||||||
if [ -n "${LATEST}" ] && [ "${VERSION}" = "${LATEST}" ]; then
|
if [ -n "${LATEST}" ] && [ "${CURRENT_VERSION}" = "${LATEST}" ]; then
|
||||||
echo "Version ${VERSION} already exists"
|
echo "Version ${CURRENT_VERSION} already exists"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -388,15 +340,13 @@ jobs:
|
|||||||
REPO=$(echo "${REPOSITORY}" | cut -d'/' -f2)
|
REPO=$(echo "${REPOSITORY}" | cut -d'/' -f2)
|
||||||
API_URL="${GITEA_URL}/api/v1/repos/${OWNER}/${REPO}"
|
API_URL="${GITEA_URL}/api/v1/repos/${OWNER}/${REPO}"
|
||||||
|
|
||||||
NAME=$(cat VERSION)
|
echo "Creating tag ${VERSION}..."
|
||||||
|
|
||||||
echo "Creating tag ${NAME}..."
|
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
--data "$(jq -n \
|
--data "$(jq -n \
|
||||||
--arg tag_name "${NAME}" \
|
--arg tag_name "${VERSION}" \
|
||||||
--arg target "${DEFAULT_BRANCH}" \
|
--arg target "${DEFAULT_BRANCH}" \
|
||||||
--arg message "${NAME}" \
|
--arg message "${VERSION}" \
|
||||||
'{tag_name: $tag_name, target: $target, message: $message}')" \
|
'{tag_name: $tag_name, target: $target, message: $message}')" \
|
||||||
"${API_URL}/tags"
|
"${API_URL}/tags"
|
||||||
|
|||||||
Reference in New Issue
Block a user