@@ -14,6 +14,25 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# --------------------------
|
||||
# Validate required vars
|
||||
# --------------------------
|
||||
- name: Check required variables
|
||||
run: |
|
||||
if [ -z "${{ vars.GITEA_SERVER_URL }}" ]; then
|
||||
echo "::error::Missing variable: GITEA_SERVER_URL. Please add it in Settings → Secrets and variables → Actions → Variables"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${{ vars.GITEA_REPO }}" ]; then
|
||||
echo "::error::Missing variable: GITEA_REPO. Please add it in Settings → Secrets and variables → Actions → Variables"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${{ secrets.RELEASE_TOKEN }}" ]; then
|
||||
echo "::error::Missing secret: RELEASE_TOKEN. Please add it in Settings → Secrets and variables → Actions → Secrets"
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ All required variables and secrets are set."
|
||||
|
||||
- name: Install rsync
|
||||
run: sudo apt-get update && sudo apt-get install -y rsync
|
||||
|
||||
@@ -90,7 +109,7 @@ jobs:
|
||||
# 4. Update Stable tag in readme.txt (if present)
|
||||
# ------------------------------------------------------------
|
||||
- name: Update Stable tag in readme.txt
|
||||
if: steps.check.outputs.should_release == 'true' && runner.os == 'Linux' && hashFiles('readme.txt') != ''
|
||||
if: steps.check.outputs.should_release == 'true' && hashFiles('readme.txt') != ''
|
||||
run: |
|
||||
sed -i -E "s/^(Stable tag:[[:space:]]*).*/\1${{ steps.meta.outputs.version }}/" readme.txt
|
||||
if ! git diff --quiet -- readme.txt; then
|
||||
@@ -98,28 +117,28 @@ jobs:
|
||||
git config user.email "actions@noreply.gitea"
|
||||
git add readme.txt
|
||||
git commit -m "chore: sync readme.txt stable tag to ${{ steps.meta.outputs.version }} [skip ci]"
|
||||
# Push using the token (set remote below)
|
||||
fi
|
||||
# Note: We'll handle the actual push later, after setting the remote.
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 5. Configure git remote with token and push everything
|
||||
# 5. Push commits and tags to Gitea (using token)
|
||||
# ------------------------------------------------------------
|
||||
- name: Push commits and tags to Gitea
|
||||
if: steps.check.outputs.should_release == 'true'
|
||||
run: |
|
||||
# Reconstruct the remote URL with the token
|
||||
GITEA_SERVER="${{ vars.GITEA_SERVER_URL }}"
|
||||
GITEA_REPO="${{ vars.GITEA_REPO }}"
|
||||
# Remove protocol part to build oauth2 URL
|
||||
TOKEN="${{ secrets.RELEASE_TOKEN }}"
|
||||
|
||||
# Strip protocol for the oauth2 URL
|
||||
SERVER_HOST="${GITEA_SERVER#https://}"
|
||||
SERVER_HOST="${SERVER_HOST#http://}"
|
||||
git remote set-url origin "https://oauth2:${{ secrets.RELEASE_TOKEN }}@${SERVER_HOST}/${GITEA_REPO}.git"
|
||||
|
||||
git remote set-url origin "https://oauth2:${TOKEN}@${SERVER_HOST}/${GITEA_REPO}.git"
|
||||
git push origin HEAD:refs/heads/main
|
||||
git push origin "${{ steps.check.outputs.tag }}"
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 6. Build the plugin zip (only if we are releasing)
|
||||
# 6. Build the plugin zip
|
||||
# ------------------------------------------------------------
|
||||
- name: Build plugin zip
|
||||
if: steps.check.outputs.should_release == 'true'
|
||||
@@ -138,7 +157,7 @@ jobs:
|
||||
zip -r "../${SLUG}-${{ steps.meta.outputs.version }}.zip" "${SLUG}"
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 7. Install tea CLI (pinned version)
|
||||
# 7. Install tea CLI
|
||||
# ------------------------------------------------------------
|
||||
- name: Install tea CLI
|
||||
if: steps.check.outputs.should_release == 'true'
|
||||
@@ -150,13 +169,12 @@ jobs:
|
||||
tea --version
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# 8. Create Gitea Release (with the asset)
|
||||
# 8. Create Gitea Release
|
||||
# ------------------------------------------------------------
|
||||
- name: Create Gitea Release (tea CLI)
|
||||
if: steps.check.outputs.should_release == 'true'
|
||||
run: |
|
||||
ZIP="${{ steps.meta.outputs.slug }}-${{ steps.meta.outputs.version }}.zip"
|
||||
# Ensure the zip exists
|
||||
if [ ! -f "$ZIP" ]; then
|
||||
echo "::error::Zip file $ZIP not found!" >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user