Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b73d858ca7 | |||
| aa4bfa33c0 | |||
| 0b9cd99fb0 | |||
| eba8df9962 | |||
| f2a39e4660 | |||
| 2f0a44706b | |||
| 10a46f8668 | |||
| db981ba4a6 | |||
|
|
aa757710c9 | ||
| 1d587ce2d1 | |||
| 0aaa7087a9 | |||
|
|
68bce5006d |
105
.github/workflows/release.yml
vendored
105
.github/workflows/release.yml
vendored
@@ -26,6 +26,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Determine plugin version
|
||||
id: meta
|
||||
@@ -85,7 +86,7 @@ jobs:
|
||||
id: tagcheck
|
||||
run: |
|
||||
TAG="v${{ steps.meta.outputs.version }}"
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; 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"
|
||||
@@ -100,20 +101,26 @@ jobs:
|
||||
if: steps.tagcheck.outputs.exists == 'false'
|
||||
id: package
|
||||
run: |
|
||||
if ! command -v zip >/dev/null 2>&1; then
|
||||
apt-get update -y
|
||||
apt-get install -y zip
|
||||
fi
|
||||
|
||||
VERSION="${{ steps.meta.outputs.version }}"
|
||||
SLUG="siti-ai-product-content-generator"
|
||||
BUILD_ROOT="$RUNNER_TEMP/build"
|
||||
DEST_DIR="$BUILD_ROOT/$SLUG"
|
||||
mkdir -p "$DEST_DIR"
|
||||
|
||||
rsync -a ./ "$DEST_DIR" \
|
||||
--exclude '.git/' \
|
||||
--exclude '.github/' \
|
||||
--exclude 'docker/' \
|
||||
--exclude 'docs/' \
|
||||
--exclude 'dist/' \
|
||||
--exclude 'docker-compose.yml' \
|
||||
--exclude 'PLAN.md'
|
||||
tar -cf - \
|
||||
--exclude='.git' \
|
||||
--exclude='.github' \
|
||||
--exclude='docker' \
|
||||
--exclude='docs' \
|
||||
--exclude='dist' \
|
||||
--exclude='docker-compose.yml' \
|
||||
--exclude='PLAN.md' \
|
||||
. | tar -xf - -C "$DEST_DIR"
|
||||
|
||||
mkdir -p dist
|
||||
ZIP_PATH="dist/${SLUG}-${VERSION}.zip"
|
||||
@@ -122,24 +129,68 @@ jobs:
|
||||
echo "asset_path=$ZIP_PATH" >> "$GITHUB_OUTPUT"
|
||||
echo "asset_name=${SLUG}-${VERSION}.zip" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Stel release-body samen
|
||||
- name: Maak Gitea release
|
||||
if: steps.tagcheck.outputs.exists == 'false'
|
||||
id: releasebody
|
||||
run: |
|
||||
if [ -n "$RELEASE_NOTES" ]; then
|
||||
echo "text=$RELEASE_NOTES" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "text=Automatische release op basis van versie ${{ steps.meta.outputs.version }}." >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
env:
|
||||
RELEASE_NOTES: ${{ github.event.inputs.release_notes }}
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
RELEASE_SERVER_URL: ${{ vars.RELEASE_SERVER_URL }}
|
||||
RELEASE_REPOSITORY: ${{ vars.RELEASE_REPOSITORY }}
|
||||
run: |
|
||||
VERSION="${{ steps.meta.outputs.version }}"
|
||||
TAG="v$VERSION"
|
||||
ASSET_PATH="${{ steps.package.outputs.asset_path }}"
|
||||
ASSET_NAME="${{ steps.package.outputs.asset_name }}"
|
||||
|
||||
if [ -z "$RELEASE_TOKEN" ]; then
|
||||
echo "::error::RELEASE_TOKEN ontbreekt. Voeg deze secret toe om releases te kunnen maken."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVER_URL="${RELEASE_SERVER_URL:-${GITHUB_SERVER_URL}}"
|
||||
REPO="${RELEASE_REPOSITORY:-${GITHUB_REPOSITORY}}"
|
||||
if [ -z "$SERVER_URL" ] || [ -z "$REPO" ]; then
|
||||
echo "::error::Kan server of repository niet bepalen. Stel RELEASE_SERVER_URL en RELEASE_REPOSITORY in."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_URL="${SERVER_URL%/}/api/v1"
|
||||
|
||||
export TAG
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
import os
|
||||
|
||||
payload = {
|
||||
"tag_name": os.environ["TAG"],
|
||||
"name": f"Siti AI Product Teksten {os.environ['TAG']}",
|
||||
"body": f"Automatische release op basis van versie {os.environ['TAG'][1:]}",
|
||||
"target_commitish": os.environ.get("GITHUB_SHA") or os.environ.get("GITEA_SHA", ""),
|
||||
}
|
||||
|
||||
with open("release.json", "w", encoding="utf-8") as handle:
|
||||
json.dump(payload, handle, ensure_ascii=False)
|
||||
PY
|
||||
|
||||
RESPONSE=$(curl -sS -X POST "$API_URL/repos/$REPO/releases" \
|
||||
-H "Authorization: token $RELEASE_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @release.json)
|
||||
|
||||
RELEASE_ID=$(python3 - <<'PY'
|
||||
import json
|
||||
import sys
|
||||
data = json.loads(sys.stdin.read())
|
||||
print(data.get('id', ''))
|
||||
PY
|
||||
<<< "$RESPONSE")
|
||||
|
||||
if [ -z "$RELEASE_ID" ]; then
|
||||
echo "::error::Kon release-ID niet bepalen. Response: $RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl -sS -X POST "$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=$ASSET_NAME" \
|
||||
-H "Authorization: token $RELEASE_TOKEN" \
|
||||
-H "Content-Type: application/zip" \
|
||||
--data-binary "@$ASSET_PATH"
|
||||
|
||||
- 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 }}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Plugin Name: SitiAI Product Teksten
|
||||
* Description: Genereer productteksten met diverse AI-aanbieders rechtstreeks vanuit WooCommerce.
|
||||
* Version: 1.9.2
|
||||
* Version: 1.9.1
|
||||
* Author: Roberto Guagliardo | SitiWeb
|
||||
* Author URI: https://sitiweb.nl/
|
||||
* Text Domain: siti-ai-product-content-generator
|
||||
|
||||
Reference in New Issue
Block a user