🎉 feat(ci): setup Gitea Actions riutilizzabili cross-repo
- Aggiunti 6 workflow condivisi in .gitea/workflows/ con trigger workflow_call - Implementati: quality-gates, npm-publish, docker-release, auto-release, dependency-check, branch-cleanup - Aggiunti esempi consumer per microservizio e libreria-npm (ci, release, maintenance) - Allineato npm run lint:check su tutti i workflow - Corretti GITEA_TOKEN, gitea.* context, GITHUB_REF/GITHUB_OUTPUT per compatibilità Gitea - Rimosso needs: tra job reusable (Gitea bug #31900), path uses: con .gitea/workflows/ Fixes #1 @1d
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
name: Auto Release
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
auto-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
run: |
|
||||
CURRENT_TAG=${GITHUB_REF#refs/tags/}
|
||||
PREV_TAG=$(git tag --sort=-version:refname | sed -n '2p')
|
||||
|
||||
if [ -z "$PREV_TAG" ]; then
|
||||
CHANGELOG=$(git log --pretty=format:"- %s (%h)" "$CURRENT_TAG")
|
||||
else
|
||||
CHANGELOG=$(git log --pretty=format:"- %s (%h)" "${PREV_TAG}..${CURRENT_TAG}")
|
||||
fi
|
||||
|
||||
echo "$CHANGELOG" > changelog.txt
|
||||
echo "current_tag=$CURRENT_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
CURRENT_TAG=${{ steps.changelog.outputs.current_tag }}
|
||||
APP_NAME=$(jq -r '.name' package.json)
|
||||
CHANGELOG=$(cat changelog.txt)
|
||||
|
||||
curl -s -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
"https://gitea.pzetatouch.it/api/v1/repos/${{ gitea.repository }}/releases" \
|
||||
-d "{
|
||||
\"tag_name\": \"$CURRENT_TAG\",
|
||||
\"name\": \"$APP_NAME $CURRENT_TAG\",
|
||||
\"body\": $(echo "$CHANGELOG" | jq -Rs .),
|
||||
\"draft\": false,
|
||||
\"prerelease\": false
|
||||
}"
|
||||
Reference in New Issue
Block a user