refactor: update release workflow to improve tagging and asset packaging
Some checks failed
Build & Release Plugin / release (push) Failing after 4s
Some checks failed
Build & Release Plugin / release (push) Failing after 4s
This commit is contained in:
76
.github/workflows/release.yml
vendored
76
.github/workflows/release.yml
vendored
@@ -1,17 +1,23 @@
|
||||
name: Generate Manifest & Tag
|
||||
name: Build & Release Plugin
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_notes:
|
||||
description: 'Optionele release-opmerkingen'
|
||||
required: false
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'groq-ai-product-text.php'
|
||||
- 'manifest.json'
|
||||
- 'includes/**'
|
||||
- 'assets/**'
|
||||
- 'README.md'
|
||||
- '.github/workflows/release.yml'
|
||||
|
||||
jobs:
|
||||
tag:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -63,11 +69,6 @@ jobs:
|
||||
print('manifest.json aangemaakt/bijgewerkt')
|
||||
PY
|
||||
|
||||
- name: Toon manifest.json
|
||||
run: |
|
||||
echo "manifest.json inhoud:"
|
||||
cat manifest.json
|
||||
|
||||
- name: Commit & push manifest.json
|
||||
run: |
|
||||
if git diff --quiet -- manifest.json; then
|
||||
@@ -85,8 +86,7 @@ jobs:
|
||||
id: tagcheck
|
||||
run: |
|
||||
TAG="v${{ steps.meta.outputs.version }}"
|
||||
git fetch --tags --force
|
||||
if git tag -l "$TAG" | grep -qx "$TAG"; then
|
||||
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q "refs/tags/$TAG$"; then
|
||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "exists=false" >> "$GITHUB_OUTPUT"
|
||||
@@ -95,24 +95,52 @@ jobs:
|
||||
- name: Tag bestaat al – workflow afronden
|
||||
if: steps.tagcheck.outputs.exists == 'true'
|
||||
run: |
|
||||
echo "Tag v${{ steps.meta.outputs.version }} bestaat al. Tag wordt overgeslagen."
|
||||
echo "Tag v${{ steps.meta.outputs.version }} bestaat al. Release wordt overgeslagen."
|
||||
|
||||
- name: Maak Gitea tag
|
||||
- name: Build distributie-zip
|
||||
if: steps.tagcheck.outputs.exists == 'false'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GITEA_SERVER_URL: ${{ vars.GITEA_SERVER_URL }}
|
||||
GITEA_REPOSITORY: ${{ vars.GITEA_REPOSITORY }}
|
||||
id: package
|
||||
run: |
|
||||
VERSION="${{ steps.meta.outputs.version }}"
|
||||
TAG="v$VERSION"
|
||||
SLUG="siti-ai-product-content-generator"
|
||||
BUILD_ROOT="$RUNNER_TEMP/build"
|
||||
DEST_DIR="$BUILD_ROOT/$SLUG"
|
||||
mkdir -p "$DEST_DIR"
|
||||
|
||||
git tag -a "$TAG" -m "$TAG"
|
||||
if [ -n "$GITEA_TOKEN" ] && [ -n "$GITEA_SERVER_URL" ] && [ -n "$GITEA_REPOSITORY" ]; then
|
||||
HOST="${GITEA_SERVER_URL#https://}"
|
||||
HOST="${HOST#http://}"
|
||||
AUTH_URL="https://oauth2:${GITEA_TOKEN}@${HOST}/${GITEA_REPOSITORY}.git"
|
||||
git push "$AUTH_URL" "$TAG"
|
||||
rsync -a ./ "$DEST_DIR" \
|
||||
--exclude '.git/' \
|
||||
--exclude '.github/' \
|
||||
--exclude 'docker/' \
|
||||
--exclude 'docs/' \
|
||||
--exclude 'dist/' \
|
||||
--exclude 'docker-compose.yml' \
|
||||
--exclude 'PLAN.md'
|
||||
|
||||
mkdir -p dist
|
||||
ZIP_PATH="dist/${SLUG}-${VERSION}.zip"
|
||||
(cd "$BUILD_ROOT" && zip -r "$GITHUB_WORKSPACE/$ZIP_PATH" "$SLUG")
|
||||
|
||||
echo "asset_path=$ZIP_PATH" >> "$GITHUB_OUTPUT"
|
||||
echo "asset_name=${SLUG}-${VERSION}.zip" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Stel release-body samen
|
||||
if: steps.tagcheck.outputs.exists == 'false'
|
||||
id: releasebody
|
||||
run: |
|
||||
if [ -n "$RELEASE_NOTES" ]; then
|
||||
echo "text=$RELEASE_NOTES" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
git push origin "$TAG"
|
||||
echo "text=Automatische release op basis van versie ${{ steps.meta.outputs.version }}." >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
env:
|
||||
RELEASE_NOTES: ${{ github.event.inputs.release_notes }}
|
||||
|
||||
- name: Maak GitHub release
|
||||
if: steps.tagcheck.outputs.exists == 'false'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.meta.outputs.version }}
|
||||
name: Siti AI Product Teksten v${{ steps.meta.outputs.version }}
|
||||
body: ${{ steps.releasebody.outputs.text }}
|
||||
generate_release_notes: true
|
||||
files: ${{ steps.package.outputs.asset_path }}
|
||||
|
||||
Reference in New Issue
Block a user