Compare commits
6 Commits
0d532363eb
...
5bebc92847
Author | SHA1 | Date | |
---|---|---|---|
5bebc92847 | |||
47d124d0ef | |||
c6e957d7f2 | |||
56190eb852 | |||
6446abae6c | |||
540350dbfa |
114
.gitea/scripts/add-annotations.sh
Executable file
114
.gitea/scripts/add-annotations.sh
Executable file
@ -0,0 +1,114 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CHART_FILE="Chart.yaml"
|
||||||
|
if [ ! -f "${CHART_FILE}" ]; then
|
||||||
|
echo "ERROR: ${CHART_FILE} not found!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEFAULT_NEW_TAG="$(git tag --sort=-version:refname | head -n 1)"
|
||||||
|
DEFAULT_OLD_TAG="$(git tag --sort=-version:refname | head -n 2 | tail -n 1)"
|
||||||
|
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
read -p "Enter start tag [${DEFAULT_OLD_TAG}]: " OLD_TAG
|
||||||
|
if [ -z "${OLD_TAG}" ]; then
|
||||||
|
OLD_TAG="${DEFAULT_OLD_TAG}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
while [ -z "$(git tag --list "${OLD_TAG}")" ]; do
|
||||||
|
echo "ERROR: Tag '${OLD_TAG}' not found!" 1>&2
|
||||||
|
read -p "Enter start tag [${DEFAULT_OLD_TAG}]: " OLD_TAG
|
||||||
|
if [ -z "${OLD_TAG}" ]; then
|
||||||
|
OLD_TAG="${DEFAULT_OLD_TAG}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
OLD_TAG=${1}
|
||||||
|
if [ -z "$(git tag --list "${OLD_TAG}")" ]; then
|
||||||
|
echo "ERROR: Tag '${OLD_TAG}' not found!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${2}" ]; then
|
||||||
|
read -p "Enter end tag [${DEFAULT_NEW_TAG}]: " NEW_TAG
|
||||||
|
if [ -z "${NEW_TAG}" ]; then
|
||||||
|
NEW_TAG="${DEFAULT_NEW_TAG}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
while [ -z "$(git tag --list "${NEW_TAG}")" ]; do
|
||||||
|
echo "ERROR: Tag '${NEW_TAG}' not found!" 1>&2
|
||||||
|
read -p "Enter end tag [${DEFAULT_NEW_TAG}]: " NEW_TAG
|
||||||
|
if [ -z "${NEW_TAG}" ]; then
|
||||||
|
NEW_TAG="${DEFAULT_NEW_TAG}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
NEW_TAG=${2}
|
||||||
|
|
||||||
|
if [ -z "$(git tag --list "${NEW_TAG}")" ]; then
|
||||||
|
echo "ERROR: Tag '${NEW_TAG}' not found!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHANGE_LOG_YAML=$(mktemp)
|
||||||
|
echo "[]" > "${CHANGE_LOG_YAML}"
|
||||||
|
|
||||||
|
function map_type_to_kind() {
|
||||||
|
case "${1}" in
|
||||||
|
feat)
|
||||||
|
echo "added"
|
||||||
|
;;
|
||||||
|
fix)
|
||||||
|
echo "fixed"
|
||||||
|
;;
|
||||||
|
chore|style|test|ci|docs|refac)
|
||||||
|
echo "changed"
|
||||||
|
;;
|
||||||
|
revert)
|
||||||
|
echo "removed"
|
||||||
|
;;
|
||||||
|
sec)
|
||||||
|
echo "security"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "skip"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
COMMIT_TITLES="$(git log --pretty=format:"%s" "${OLD_TAG}..${NEW_TAG}")"
|
||||||
|
|
||||||
|
echo "INFO: Generate change log entries from ${OLD_TAG} until ${NEW_TAG}"
|
||||||
|
|
||||||
|
while IFS= read -r line; do
|
||||||
|
if [[ "${line}" =~ ^([a-zA-Z]+)(\([^\)]+\))?\:\ (.+)$ ]]; then
|
||||||
|
TYPE="${BASH_REMATCH[1]}"
|
||||||
|
KIND=$(map_type_to_kind "${TYPE}")
|
||||||
|
|
||||||
|
if [ "${KIND}" == "skip" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
DESC="${BASH_REMATCH[3]}"
|
||||||
|
|
||||||
|
echo "- ${KIND}: ${DESC}"
|
||||||
|
|
||||||
|
jq --arg kind changed --arg description "$DESC" '. += [ $ARGS.named ]' < ${CHANGE_LOG_YAML} > ${CHANGE_LOG_YAML}.new
|
||||||
|
mv ${CHANGE_LOG_YAML}.new ${CHANGE_LOG_YAML}
|
||||||
|
|
||||||
|
fi
|
||||||
|
done <<< "${COMMIT_TITLES}"
|
||||||
|
|
||||||
|
if [ -s "${CHANGE_LOG_YAML}" ]; then
|
||||||
|
yq --inplace --input-format json --output-format yml "${CHANGE_LOG_YAML}"
|
||||||
|
yq --no-colors --inplace ".annotations.\"artifacthub.io/changes\" |= loadstr(\"${CHANGE_LOG_YAML}\") | sort_keys(.)" "${CHART_FILE}"
|
||||||
|
else
|
||||||
|
echo "ERROR: Changelog file is empty: ${CHANGE_LOG_YAML}" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm "${CHANGE_LOG_YAML}"
|
@ -1,32 +0,0 @@
|
|||||||
name: changelog
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
changelog:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: docker.io/thegeeklab/git-sv:2.0.1
|
|
||||||
steps:
|
|
||||||
- name: install tools
|
|
||||||
run: |
|
|
||||||
apk add -q --update --no-cache nodejs curl jq sed
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Generate upcoming changelog
|
|
||||||
run: |
|
|
||||||
git sv rn -o changelog.md
|
|
||||||
export RELEASE_NOTES=$(cat changelog.md)
|
|
||||||
export ISSUE_NUMBER=$(curl -s "https://gitea.com/api/v1/repos/gitea/helm-gitea/issues?state=open&q=Changelog%20for%20upcoming%20version" | jq '.[].number')
|
|
||||||
|
|
||||||
echo $RELEASE_NOTES
|
|
||||||
JSON_DATA=$(echo "" | jq -Rs --arg title 'Changelog for upcoming version' --arg body "$(cat changelog.md)" '{title: $title, body: $body}')
|
|
||||||
|
|
||||||
if [ -z "$ISSUE_NUMBER" ]; then
|
|
||||||
curl -s -X POST "https://gitea.com/api/v1/repos/gitea/helm-gitea/issues" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA"
|
|
||||||
else
|
|
||||||
curl -s -X PATCH "https://gitea.com/api/v1/repos/gitea/helm-gitea/issues/$ISSUE_NUMBER" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA"
|
|
||||||
fi
|
|
@ -1,19 +0,0 @@
|
|||||||
name: commitlint
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- "*"
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- edited
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-and-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: commitlint/commitlint:19.8.1
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: check PR title
|
|
||||||
run: |
|
|
||||||
echo "${{ gitea.event.pull_request.title }}" | commitlint --config .commitlintrc.json
|
|
@ -2,9 +2,8 @@ name: generate-chart
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
branches:
|
||||||
- "*"
|
- '**'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# renovate: datasource=docker depName=alpine/helm
|
# renovate: datasource=docker depName=alpine/helm
|
||||||
HELM_VERSION: "3.17.3"
|
HELM_VERSION: "3.17.3"
|
||||||
@ -14,15 +13,28 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- name: Determine OS and Architecture
|
||||||
|
run: |
|
||||||
|
# determine operating system
|
||||||
|
OS=$(uname | tr '[:upper:]' '[:lower:]')
|
||||||
|
echo "OS=${OS}" >> ${GITHUB_ENV}
|
||||||
|
|
||||||
|
# determine architecture
|
||||||
|
ARCH="$(uname -m)"
|
||||||
|
case "${ARCH}" in
|
||||||
|
x86_64) ARCH=amd64;;
|
||||||
|
esac
|
||||||
|
echo "ARCH=${ARCH}" >> ${GITHUB_ENV}
|
||||||
|
|
||||||
- name: install tools
|
- name: install tools
|
||||||
run: |
|
run: |
|
||||||
apt update -y
|
apt update -y
|
||||||
apt install -y curl ca-certificates curl gnupg
|
apt install -y curl ca-certificates curl gnupg
|
||||||
# helm
|
# helm
|
||||||
curl -O https://get.helm.sh/helm-v${{ env.HELM_VERSION }}-linux-amd64.tar.gz
|
curl -O https://get.helm.sh/helm-v${{ env.HELM_VERSION }}-${OS}-${ARCH}.tar.gz
|
||||||
tar -xzf helm-v${{ env.HELM_VERSION }}-linux-amd64.tar.gz
|
tar -xzf helm-v${{ env.HELM_VERSION }}-${OS}-${ARCH}.tar.gz
|
||||||
mv linux-amd64/helm /usr/local/bin/
|
mv ${OS}-${ARCH}/helm /usr/local/bin/
|
||||||
rm -rf linux-amd64 helm-v${{ env.HELM_VERSION }}-linux-amd64.tar.gz
|
rm -rf ${OS}-${ARCH} helm-v${{ env.HELM_VERSION }}-${OS}-${ARCH}.tar.gz
|
||||||
helm version
|
helm version
|
||||||
# docker
|
# docker
|
||||||
install -m 0755 -d /etc/apt/keyrings
|
install -m 0755 -d /etc/apt/keyrings
|
||||||
@ -32,65 +44,83 @@ jobs:
|
|||||||
apt update -y
|
apt update -y
|
||||||
apt install -y python3 python3-pip apt-transport-https docker-ce-cli
|
apt install -y python3 python3-pip apt-transport-https docker-ce-cli
|
||||||
pip install awscli --break-system-packages
|
pip install awscli --break-system-packages
|
||||||
|
# jq
|
||||||
|
apt install -y jq
|
||||||
|
|
||||||
- name: Import GPG key
|
# - name: Import GPG key
|
||||||
id: import_gpg
|
# id: import_gpg
|
||||||
uses: https://github.com/crazy-max/ghaction-import-gpg@v6
|
# uses: https://github.com/crazy-max/ghaction-import-gpg@v6
|
||||||
with:
|
# with:
|
||||||
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
|
# gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
|
||||||
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
# passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
||||||
fingerprint: CC64B1DB67ABBEECAB24B6455FC346329753F4B0
|
# fingerprint: CC64B1DB67ABBEECAB24B6455FC346329753F4B0
|
||||||
|
|
||||||
# Using helm gpg plugin as 'helm package --sign' has issues with gpg2: https://github.com/helm/helm/issues/2843
|
- name: Add Artifacthub.io annotations
|
||||||
- name: package chart
|
env:
|
||||||
|
YQ_VERSION: v4.45.4 # renovate: datasource=github-releases depName=mikefarah/yq
|
||||||
run: |
|
run: |
|
||||||
echo ${{ secrets.DOCKER_CHARTS_PASSWORD }} | docker login -u ${{ secrets.DOCKER_CHARTS_USERNAME }} --password-stdin
|
|
||||||
# FIXME: use upstream after https://github.com/technosophos/helm-gpg/issues/1 is solved
|
|
||||||
helm plugin install https://github.com/pat-s/helm-gpg
|
|
||||||
helm dependency build
|
|
||||||
helm package --version "${GITHUB_REF#refs/tags/v}" ./
|
|
||||||
mkdir gitea
|
|
||||||
mv gitea*.tgz gitea/
|
|
||||||
curl -s -L -o gitea/index.yaml https://dl.gitea.com/charts/index.yaml
|
|
||||||
helm repo index gitea/ --url https://dl.gitea.com/charts --merge gitea/index.yaml
|
|
||||||
# push to dockerhub
|
|
||||||
echo ${{ secrets.DOCKER_CHARTS_PASSWORD }} | helm registry login -u ${{ secrets.DOCKER_CHARTS_USERNAME }} registry-1.docker.io --password-stdin
|
|
||||||
helm push gitea/gitea-${GITHUB_REF#refs/tags/v}.tgz oci://registry-1.docker.io/giteacharts
|
|
||||||
helm registry logout registry-1.docker.io
|
|
||||||
|
|
||||||
- name: aws credential configure
|
|
||||||
uses: https://github.com/aws-actions/configure-aws-credentials@v4
|
|
||||||
with:
|
|
||||||
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
|
|
||||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
aws-region: ${{ secrets.AWS_REGION }}
|
|
||||||
|
|
||||||
- name: Copy files to S3 and clear cache
|
# Download yq
|
||||||
run: |
|
curl --silent --fail --location https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_${OS}_${ARCH}.tar.gz --output /dev/stdout | tar --extract --gzip && mv yq_${OS}_${ARCH} /usr/bin/yq
|
||||||
aws s3 sync gitea/ s3://${{ secrets.AWS_S3_BUCKET}}/charts/
|
|
||||||
|
|
||||||
release-gitea:
|
NEW_TAG="$(git tag --sort=-version:refname | head -n 1)"
|
||||||
# needs: generate-chart-publish
|
OLD_TAG="$(git tag --sort=-version:refname | head -n 2 | tail -n 1)"
|
||||||
runs-on: ubuntu-latest
|
.gitea/scripts/add-annotations.sh "${OLD_TAG}" "${NEW_TAG}"
|
||||||
container: docker.io/thegeeklab/git-sv:2.0.1
|
|
||||||
steps:
|
|
||||||
- name: install tools
|
|
||||||
run: |
|
|
||||||
apk add -q --update --no-cache nodejs
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-tags: true
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Create changelog
|
- name: Print Chart.yaml
|
||||||
run: |
|
run: cat Chart.yaml
|
||||||
git sv current-version
|
|
||||||
git sv release-notes -t ${GITHUB_REF#refs/tags/} -o CHANGELOG.md
|
|
||||||
sed -i '1,2d' CHANGELOG.md # remove version
|
|
||||||
cat CHANGELOG.md
|
|
||||||
|
|
||||||
- name: Release
|
# # Using helm gpg plugin as 'helm package --sign' has issues with gpg2: https://github.com/helm/helm/issues/2843
|
||||||
uses: https://github.com/akkuman/gitea-release-action@v1
|
# - name: package chart
|
||||||
with:
|
# run: |
|
||||||
body_path: CHANGELOG.md
|
# echo ${{ secrets.DOCKER_CHARTS_PASSWORD }} | docker login -u ${{ secrets.DOCKER_CHARTS_USERNAME }} --password-stdin
|
||||||
token: "${{ secrets.RELEASE_TOKEN }}"
|
# # FIXME: use upstream after https://github.com/technosophos/helm-gpg/issues/1 is solved
|
||||||
|
# helm plugin install https://github.com/pat-s/helm-gpg
|
||||||
|
# helm dependency build
|
||||||
|
# helm package --version "${GITHUB_REF#refs/tags/v}" ./
|
||||||
|
# mkdir gitea
|
||||||
|
# mv gitea*.tgz gitea/
|
||||||
|
# curl -s -L -o gitea/index.yaml https://dl.gitea.com/charts/index.yaml
|
||||||
|
# helm repo index gitea/ --url https://dl.gitea.com/charts --merge gitea/index.yaml
|
||||||
|
# # push to dockerhub
|
||||||
|
# echo ${{ secrets.DOCKER_CHARTS_PASSWORD }} | helm registry login -u ${{ secrets.DOCKER_CHARTS_USERNAME }} registry-1.docker.io --password-stdin
|
||||||
|
# helm push gitea/gitea-${GITHUB_REF#refs/tags/v}.tgz oci://registry-1.docker.io/giteacharts
|
||||||
|
# helm registry logout registry-1.docker.io
|
||||||
|
|
||||||
|
# - name: aws credential configure
|
||||||
|
# uses: https://github.com/aws-actions/configure-aws-credentials@v4
|
||||||
|
# with:
|
||||||
|
# aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
|
||||||
|
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
# aws-region: ${{ secrets.AWS_REGION }}
|
||||||
|
|
||||||
|
# - name: Copy files to S3 and clear cache
|
||||||
|
# run: |
|
||||||
|
# aws s3 sync gitea/ s3://${{ secrets.AWS_S3_BUCKET}}/charts/
|
||||||
|
|
||||||
|
# release-gitea:
|
||||||
|
# # needs: generate-chart-publish
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# container: docker.io/thegeeklab/git-sv:2.0.1
|
||||||
|
# steps:
|
||||||
|
# - name: install tools
|
||||||
|
# run: |
|
||||||
|
# apk add -q --update --no-cache nodejs
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with:
|
||||||
|
# fetch-tags: true
|
||||||
|
# fetch-depth: 0
|
||||||
|
|
||||||
|
# - name: Create changelog
|
||||||
|
# run: |
|
||||||
|
# git sv current-version
|
||||||
|
# git sv release-notes -t ${GITHUB_REF#refs/tags/} -o CHANGELOG.md
|
||||||
|
# sed -i '1,2d' CHANGELOG.md # remove version
|
||||||
|
# cat CHANGELOG.md
|
||||||
|
|
||||||
|
# - name: Release
|
||||||
|
# uses: https://github.com/akkuman/gitea-release-action@v1
|
||||||
|
# with:
|
||||||
|
# body_path: CHANGELOG.md
|
||||||
|
# token: "${{ secrets.RELEASE_TOKEN }}"
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
name: check-and-test
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- "*"
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
# renovate: datasource=github-releases depName=helm-unittest/helm-unittest
|
|
||||||
HELM_UNITTEST_VERSION: "v0.8.2"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-and-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: alpine/helm:3.17.3
|
|
||||||
steps:
|
|
||||||
- name: install tools
|
|
||||||
run: |
|
|
||||||
apk update
|
|
||||||
apk add --update bash make nodejs npm yamllint ncurses
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: install chart dependencies
|
|
||||||
run: helm dependency build
|
|
||||||
- name: lint
|
|
||||||
run: helm lint
|
|
||||||
- name: template
|
|
||||||
run: helm template --debug gitea-helm .
|
|
||||||
- name: prepare unit test environment
|
|
||||||
run: |
|
|
||||||
helm plugin install --version ${{ env.HELM_UNITTEST_VERSION }} https://github.com/helm-unittest/helm-unittest
|
|
||||||
git submodule update --init --recursive
|
|
||||||
- name: unit tests
|
|
||||||
env:
|
|
||||||
TERM: xterm
|
|
||||||
run: |
|
|
||||||
make unittests
|
|
||||||
- name: verify readme
|
|
||||||
run: |
|
|
||||||
make readme
|
|
||||||
git diff --exit-code --name-only README.md
|
|
||||||
- name: yaml lint
|
|
||||||
uses: https://github.com/ibiqlik/action-yamllint@v3
|
|
Loading…
x
Reference in New Issue
Block a user