ci: switch release pipelines to gitea only
This commit is contained in:
@@ -20,7 +20,6 @@ jobs:
|
||||
|
||||
- name: Container image name
|
||||
run: |
|
||||
owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')
|
||||
echo "IMAGE_NAME=${REGISTRY_HOST}/kloude-public/kks-provider-plugin" >> "$GITHUB_ENV"
|
||||
echo "APP_VERSION=$(grep '^appVersion:' charts/kks-provider-plugin/Chart.yaml | awk '{print $2}' | tr -d '\"')" >> "$GITHUB_ENV"
|
||||
|
||||
@@ -52,11 +51,3 @@ jobs:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Make container image public
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')
|
||||
gh api --method PATCH "/orgs/${owner}/packages/container/kks-provider-plugin/visibility" -f visibility=public || true
|
||||
|
||||
@@ -117,9 +117,3 @@ jobs:
|
||||
echo "OCI push failed for $chart (registry token realm/protocol issue). Continuing because chart artifact is already published to Gitea release assets."
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Make OCI chart public
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh api --method PATCH "/orgs/kloude/kks-provider-plugin/packages/container/charts%2Fkks-provider-plugin/visibility" -f visibility=public || true
|
||||
|
||||
@@ -48,52 +48,8 @@ jobs:
|
||||
helm package "${chart_dir}" --destination dist
|
||||
echo "CHART_PACKAGE=dist/kks-provider-plugin-${version}.tgz" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build changelog
|
||||
id: changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v5
|
||||
with:
|
||||
configurationJson: |
|
||||
{
|
||||
"template": "#{{CHANGELOG}}\n\n**Full Changelog**: #{{RELEASE_DIFF}}",
|
||||
"categories": [
|
||||
{
|
||||
"title": "## Features",
|
||||
"commits": ["^feat", "^feature"]
|
||||
},
|
||||
{
|
||||
"title": "## Bug Fixes",
|
||||
"commits": ["^fix", "^Fix"]
|
||||
},
|
||||
{
|
||||
"title": "## Other Changes",
|
||||
"commits": [".*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create or update GitHub release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
CHANGELOG: ${{ steps.changelog.outputs.changelog }}
|
||||
run: |
|
||||
if gh release view "$TAG" >/dev/null 2>&1; then
|
||||
gh release edit "$TAG" --notes "$CHANGELOG"
|
||||
else
|
||||
gh release create "$TAG" --title "$TAG" --notes "$CHANGELOG"
|
||||
fi
|
||||
|
||||
- name: Upload Helm chart to release
|
||||
if: steps.version.outputs.is_app_release == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
run: gh release upload "$TAG" "$CHART_PACKAGE" --clobber
|
||||
|
||||
- name: Upload Helm chart artifact to Gitea release
|
||||
if: steps.version.outputs.is_app_release == 'true' && secrets.GITEA_TOKEN != ''
|
||||
- name: Create or update Gitea release
|
||||
if: secrets.GITEA_TOKEN != ''
|
||||
env:
|
||||
GITEA_BASE_URL: https://git.kloude.ir
|
||||
GITEA_REPO: kloude/kks-provider-plugin
|
||||
@@ -102,13 +58,9 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if [ ! -f "$CHART_PACKAGE" ]; then
|
||||
echo "Chart package not found: $CHART_PACKAGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
api="${GITEA_BASE_URL}/api/v1/repos/${GITEA_REPO}"
|
||||
file_name=$(basename "$CHART_PACKAGE")
|
||||
release_name="$TAG"
|
||||
release_body="Release ${TAG}"
|
||||
|
||||
release_json=$(curl -fsS \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
@@ -119,10 +71,30 @@ jobs:
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${api}/releases" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"target_commitish\":\"${GITHUB_SHA}\"}")
|
||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${release_name}\",\"body\":\"${release_body}\",\"target_commitish\":\"${GITHUB_SHA}\"}")
|
||||
else
|
||||
release_id=$(python3 -c 'import json,sys; print(json.loads(sys.stdin.read())["id"])' <<< "$release_json")
|
||||
curl -fsS -X PATCH \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${api}/releases/${release_id}" \
|
||||
-d "{\"name\":\"${release_name}\",\"body\":\"${release_body}\"}" >/dev/null
|
||||
release_json=$(curl -fsS \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"${api}/releases/tags/${TAG}")
|
||||
fi
|
||||
|
||||
if [ "${{ steps.version.outputs.is_app_release }}" != "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f "$CHART_PACKAGE" ]; then
|
||||
echo "Chart package not found: $CHART_PACKAGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
release_id=$(python3 -c 'import json,sys; print(json.loads(sys.stdin.read())["id"])' <<< "$release_json")
|
||||
file_name=$(basename "$CHART_PACKAGE")
|
||||
|
||||
existing_assets=$(curl -fsS \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
@@ -154,11 +126,3 @@ jobs:
|
||||
"$CHART_PACKAGE" "$repo"; then
|
||||
echo "OCI push failed (registry token realm/protocol issue). Continuing because chart artifact is already published to Gitea release assets."
|
||||
fi
|
||||
|
||||
- name: Make OCI chart public
|
||||
if: steps.version.outputs.is_app_release == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')
|
||||
gh api --method PATCH "/orgs/${owner}/packages/container/charts%2Fkks-provider-plugin/visibility" -f visibility=public || true
|
||||
|
||||
Reference in New Issue
Block a user