Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8b57ba217 | ||
| 8d8809d0c7 | |||
|
|
55a0f4f566 | ||
| f488f32d88 | |||
|
|
9154929de9 | ||
| c2cc0d5ed5 | |||
|
|
aa38348fdd | ||
| 02ab544a37 | |||
|
|
3707a6d38a | ||
| fe1f4abf2d | |||
| 147389724e |
@@ -8,6 +8,9 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
|
||||||
|
# Large AppImage/exe uploads time out on Gitea's actions artifact pipeline.
|
||||||
|
# Build jobs publish assets straight to Gitea/GitHub releases via the REST API.
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
increment-version:
|
increment-version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -105,10 +108,101 @@ jobs:
|
|||||||
echo "VERSION=${{ steps.decide.outputs.CURRENT_VERSION }}" >> $GITHUB_OUTPUT
|
echo "VERSION=${{ steps.decide.outputs.CURRENT_VERSION }}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
prepare-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: increment-version
|
||||||
|
if: always() && needs.increment-version.outputs.should_build == 'true'
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.VERSION }}
|
||||||
|
tag: ${{ steps.version.outputs.TAG_NAME }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.ref_name }}
|
||||||
|
|
||||||
|
- name: Pull latest (after version bump)
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
run: git pull origin main
|
||||||
|
|
||||||
|
- name: Resolve version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
if [ -n "${{ needs.increment-version.outputs.version }}" ]; then
|
||||||
|
VERSION="${{ needs.increment-version.outputs.version }}"
|
||||||
|
else
|
||||||
|
VERSION=$(grep -Po '"version":\s*"\K[^"]+' package.json | head -1)
|
||||||
|
fi
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "TAG_NAME=v$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "Version: $VERSION"
|
||||||
|
|
||||||
|
- name: Create and push tag
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.version.outputs.VERSION }}"
|
||||||
|
TAG_NAME="v${VERSION}"
|
||||||
|
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
|
||||||
|
echo "Tag $TAG_NAME already exists"
|
||||||
|
else
|
||||||
|
git config user.name "GitHub Actions"
|
||||||
|
git config user.email "actions@github.com"
|
||||||
|
git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
|
||||||
|
git push origin "$TAG_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Ensure Gitea release
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
VERSION="${{ steps.version.outputs.VERSION }}"
|
||||||
|
TAG_NAME="v${VERSION}"
|
||||||
|
API_BASE="${{ github.server_url }}/api/v1"
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
|
||||||
|
RELEASE_ID=$(curl -fsS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"${API_BASE}/repos/${REPO}/releases/tags/${TAG_NAME}" | jq -r '.id // empty' || true)
|
||||||
|
|
||||||
|
if [ -z "$RELEASE_ID" ]; then
|
||||||
|
echo "Creating Gitea release ${TAG_NAME}..."
|
||||||
|
RELEASE_ID=$(curl -fsS -X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\": \"${TAG_NAME}\", \"name\": \"Release ${TAG_NAME}\", \"body\": \"Release ${VERSION}\", \"draft\": false, \"prerelease\": false}" \
|
||||||
|
"${API_BASE}/repos/${REPO}/releases" | jq -r '.id')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Gitea release id: ${RELEASE_ID}"
|
||||||
|
|
||||||
|
- name: Ensure GitHub release
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GHTOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
VERSION="${{ steps.version.outputs.VERSION }}"
|
||||||
|
TAG_NAME="v${VERSION}"
|
||||||
|
GITHUB_REPO="Paarrot/Paarrot-Desktop"
|
||||||
|
|
||||||
|
RELEASE_ID=$(curl -fsS -H "Authorization: token ${GH_TOKEN}" \
|
||||||
|
"https://api.github.com/repos/${GITHUB_REPO}/releases/tags/${TAG_NAME}" | jq -r '.id // empty' || true)
|
||||||
|
|
||||||
|
if [ -z "$RELEASE_ID" ]; then
|
||||||
|
echo "Creating GitHub release ${TAG_NAME}..."
|
||||||
|
RELEASE_ID=$(curl -fsS -X POST \
|
||||||
|
-H "Authorization: token ${GH_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\": \"${TAG_NAME}\", \"name\": \"Release ${TAG_NAME}\", \"body\": \"Release ${VERSION}\", \"draft\": false, \"prerelease\": false}" \
|
||||||
|
"https://api.github.com/repos/${GITHUB_REPO}/releases" | jq -r '.id')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "GitHub release id: ${RELEASE_ID}"
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
runs-on: windows
|
runs-on: windows
|
||||||
needs: increment-version
|
needs: [increment-version, prepare-release]
|
||||||
if: always() && (needs.increment-version.outputs.should_build == 'true' || needs.increment-version.result == 'skipped')
|
if: always() && needs.prepare-release.result == 'success'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -120,16 +214,29 @@ jobs:
|
|||||||
- name: Checkout submodules manually
|
- name: Checkout submodules manually
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
# Use the same host/scheme the runner already used for origin (not public HTTPS).
|
||||||
|
$origin = (git remote get-url origin).Trim()
|
||||||
|
$origin = $origin.TrimEnd('/')
|
||||||
|
if ($origin.EndsWith('.git')) { $origin = $origin.Substring(0, $origin.Length - 4) }
|
||||||
|
$base = $origin.Substring(0, $origin.LastIndexOf('/'))
|
||||||
|
$cinnyUrl = "$base/cinny.git"
|
||||||
|
Write-Host "Rewriting submodule URL to $cinnyUrl"
|
||||||
|
git config submodule.cinny.url $cinnyUrl
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
|
|
||||||
if (git submodule update --init --recursive) {
|
git submodule update --init --recursive
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
Write-Host "Submodules checked out at pinned commits."
|
Write-Host "Submodules checked out at pinned commits."
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Warning "Pinned submodule commit is unavailable on remote. Falling back to remote submodule HEAD."
|
Write-Warning "Pinned submodule commit is unavailable on remote. Falling back to remote submodule HEAD."
|
||||||
git submodule deinit -f --all
|
git submodule deinit -f --all
|
||||||
|
git config submodule.cinny.url $cinnyUrl
|
||||||
|
git submodule sync --recursive
|
||||||
git submodule update --init --recursive --remote
|
git submodule update --init --recursive --remote
|
||||||
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||||
|
|
||||||
Write-Host "Resolved submodule commit:"
|
Write-Host "Resolved submodule commit:"
|
||||||
git -C cinny rev-parse HEAD
|
git -C cinny rev-parse HEAD
|
||||||
@@ -162,17 +269,92 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GHTOKEN }}
|
GH_TOKEN: ${{ secrets.GHTOKEN }}
|
||||||
|
|
||||||
- name: Upload NSIS Installer (x64)
|
- name: Upload Windows assets to releases
|
||||||
uses: actions/upload-artifact@v3
|
shell: powershell
|
||||||
with:
|
env:
|
||||||
name: Paarrot-Setup-x64.exe
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
path: dist-electron/Paarrot-*-win-x64.exe
|
GH_TOKEN: ${{ secrets.GHTOKEN }}
|
||||||
|
run: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
$TAG_NAME = "${{ needs.prepare-release.outputs.tag }}"
|
||||||
|
$API_BASE = "${{ github.server_url }}/api/v1"
|
||||||
|
$REPO = "${{ github.repository }}"
|
||||||
|
$GITHUB_REPO = "Paarrot/Paarrot-Desktop"
|
||||||
|
|
||||||
- name: Upload latest.yml
|
function Invoke-JsonCurl([string[]]$CurlArgs) {
|
||||||
uses: actions/upload-artifact@v3
|
$raw = & curl.exe @CurlArgs
|
||||||
with:
|
if ($LASTEXITCODE -ne 0) { throw "curl failed: $($CurlArgs -join ' ')" }
|
||||||
name: latest.yml
|
return ($raw | ConvertFrom-Json)
|
||||||
path: dist-electron/latest.yml
|
}
|
||||||
|
|
||||||
|
$giteaRelease = Invoke-JsonCurl @(
|
||||||
|
"-fsS", "-H", "Authorization: token $env:GITEA_TOKEN",
|
||||||
|
"$API_BASE/repos/$REPO/releases/tags/$TAG_NAME"
|
||||||
|
)
|
||||||
|
$ghRelease = Invoke-JsonCurl @(
|
||||||
|
"-fsS", "-H", "Authorization: token $env:GH_TOKEN",
|
||||||
|
"https://api.github.com/repos/$GITHUB_REPO/releases/tags/$TAG_NAME"
|
||||||
|
)
|
||||||
|
# GitHub returns upload_url like .../assets{?name,label}
|
||||||
|
$ghUploadUrl = [string]$ghRelease.upload_url
|
||||||
|
if ([string]::IsNullOrWhiteSpace($ghUploadUrl)) {
|
||||||
|
throw "GitHub release $($ghRelease.id) has no upload_url"
|
||||||
|
}
|
||||||
|
$ghUploadUrl = $ghUploadUrl -replace '\{\?[^}]*\}', ''
|
||||||
|
Write-Host "GitHub upload base: $ghUploadUrl"
|
||||||
|
|
||||||
|
function Upload-One([string]$File) {
|
||||||
|
$filename = [System.IO.Path]::GetFileName($File)
|
||||||
|
$sizeMb = [math]::Round((Get-Item $File).Length / 1MB, 1)
|
||||||
|
Write-Host "Uploading $filename (${sizeMb} MB)..."
|
||||||
|
|
||||||
|
$giteaAssets = Invoke-JsonCurl @(
|
||||||
|
"-fsS", "-H", "Authorization: token $env:GITEA_TOKEN",
|
||||||
|
"$API_BASE/repos/$REPO/releases/$($giteaRelease.id)/assets"
|
||||||
|
)
|
||||||
|
foreach ($asset in @($giteaAssets)) {
|
||||||
|
if ($asset.name -eq $filename) {
|
||||||
|
& curl.exe -fsS -X DELETE -H "Authorization: token $env:GITEA_TOKEN" `
|
||||||
|
"$API_BASE/repos/$REPO/releases/$($giteaRelease.id)/assets/$($asset.id)" | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& curl.exe -fsS --max-time 0 --retry 5 --retry-delay 10 `
|
||||||
|
-X POST `
|
||||||
|
-H "Authorization: token $env:GITEA_TOKEN" `
|
||||||
|
-H "Content-Type: application/octet-stream" `
|
||||||
|
--data-binary "@$File" `
|
||||||
|
"$API_BASE/repos/$REPO/releases/$($giteaRelease.id)/assets?name=$filename" | Out-Null
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "Gitea upload failed for $filename" }
|
||||||
|
Write-Host " Gitea: ok"
|
||||||
|
|
||||||
|
$ghAssets = Invoke-JsonCurl @(
|
||||||
|
"-fsS", "-H", "Authorization: token $env:GH_TOKEN",
|
||||||
|
"https://api.github.com/repos/$GITHUB_REPO/releases/$($ghRelease.id)/assets"
|
||||||
|
)
|
||||||
|
foreach ($asset in @($ghAssets)) {
|
||||||
|
if ($asset.name -eq $filename) {
|
||||||
|
& curl.exe -fsS -X DELETE -H "Authorization: token $env:GH_TOKEN" `
|
||||||
|
"https://api.github.com/repos/$GITHUB_REPO/releases/assets/$($asset.id)" | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Brace the variable — `$url?name=` is parsed as PowerShell's null-conditional.
|
||||||
|
$ghAssetUrl = "${ghUploadUrl}?name=$([uri]::EscapeDataString($filename))"
|
||||||
|
Write-Host " GitHub URL: $ghAssetUrl"
|
||||||
|
& curl.exe -fsS --max-time 0 --retry 5 --retry-delay 10 `
|
||||||
|
-X POST `
|
||||||
|
-H "Authorization: token $env:GH_TOKEN" `
|
||||||
|
-H "Content-Type: application/octet-stream" `
|
||||||
|
--data-binary "@$File" `
|
||||||
|
$ghAssetUrl | Out-Null
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "GitHub upload failed for $filename" }
|
||||||
|
Write-Host " GitHub: ok"
|
||||||
|
}
|
||||||
|
|
||||||
|
Get-ChildItem -Path dist-electron -File |
|
||||||
|
Where-Object { $_.Name -like 'Paarrot-*-win-x64.exe' -or $_.Name -eq 'latest.yml' } |
|
||||||
|
ForEach-Object { Upload-One $_.FullName }
|
||||||
|
|
||||||
- name: List build output
|
- name: List build output
|
||||||
shell: powershell
|
shell: powershell
|
||||||
@@ -181,8 +363,8 @@ jobs:
|
|||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: increment-version
|
needs: [increment-version, prepare-release]
|
||||||
if: always() && (needs.increment-version.outputs.should_build == 'true' || needs.increment-version.result == 'skipped')
|
if: always() && needs.prepare-release.result == 'success'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -194,6 +376,14 @@ jobs:
|
|||||||
- name: Checkout submodules manually
|
- name: Checkout submodules manually
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
# Use the same host/scheme the runner already used for origin (not public HTTPS).
|
||||||
|
ORIGIN_URL=$(git remote get-url origin)
|
||||||
|
ORIGIN_URL=${ORIGIN_URL%/}
|
||||||
|
ORIGIN_URL=${ORIGIN_URL%.git}
|
||||||
|
BASE_URL=${ORIGIN_URL%/*}
|
||||||
|
CINNY_URL="${BASE_URL}/cinny.git"
|
||||||
|
echo "Rewriting submodule URL to ${CINNY_URL}"
|
||||||
|
git config submodule.cinny.url "${CINNY_URL}"
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
|
|
||||||
if git submodule update --init --recursive; then
|
if git submodule update --init --recursive; then
|
||||||
@@ -202,7 +392,10 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Pinned submodule commit is unavailable on remote. Falling back to remote submodule HEAD."
|
echo "Pinned submodule commit is unavailable on remote. Falling back to remote submodule HEAD."
|
||||||
git submodule deinit -f --all
|
git submodule deinit -f --all || true
|
||||||
|
rm -rf cinny .git/modules/cinny
|
||||||
|
git config submodule.cinny.url "${CINNY_URL}"
|
||||||
|
git submodule sync --recursive
|
||||||
git submodule update --init --recursive --remote
|
git submodule update --init --recursive --remote
|
||||||
|
|
||||||
echo "Resolved submodule commit:"
|
echo "Resolved submodule commit:"
|
||||||
@@ -233,208 +426,126 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GHTOKEN }}
|
GH_TOKEN: ${{ secrets.GHTOKEN }}
|
||||||
|
|
||||||
- name: Upload AppImage
|
- name: Upload Linux assets to releases
|
||||||
uses: actions/upload-artifact@v3
|
env:
|
||||||
with:
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
name: Paarrot-Linux-x64.AppImage
|
GH_TOKEN: ${{ secrets.GHTOKEN }}
|
||||||
path: dist-electron/Paarrot-*.AppImage
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
VERSION="${{ needs.prepare-release.outputs.version }}"
|
||||||
|
TAG_NAME="${{ needs.prepare-release.outputs.tag }}"
|
||||||
|
API_BASE="${{ github.server_url }}/api/v1"
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
GITHUB_REPO="Paarrot/Paarrot-Desktop"
|
||||||
|
|
||||||
- name: Upload latest-linux.yml
|
GITEA_RELEASE_ID=$(curl -fsS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
uses: actions/upload-artifact@v3
|
"${API_BASE}/repos/${REPO}/releases/tags/${TAG_NAME}" | jq -r '.id')
|
||||||
with:
|
GH_RELEASE_ID=$(curl -fsS -H "Authorization: token ${GH_TOKEN}" \
|
||||||
name: latest-linux.yml
|
"https://api.github.com/repos/${GITHUB_REPO}/releases/tags/${TAG_NAME}" | jq -r '.id')
|
||||||
path: dist-electron/latest-linux.yml
|
GH_UPLOAD_URL=$(curl -fsS -H "Authorization: token ${GH_TOKEN}" \
|
||||||
|
"https://api.github.com/repos/${GITHUB_REPO}/releases/${GH_RELEASE_ID}" | jq -r '.upload_url' | sed 's/{?name,label}//')
|
||||||
|
|
||||||
create-release:
|
upload_one() {
|
||||||
|
local FILE="$1"
|
||||||
|
local FILENAME
|
||||||
|
FILENAME=$(basename "$FILE")
|
||||||
|
echo "Uploading ${FILENAME} ($(du -h "$FILE" | cut -f1))..."
|
||||||
|
|
||||||
|
OLD_ID=$(curl -fsS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"${API_BASE}/repos/${REPO}/releases/${GITEA_RELEASE_ID}/assets" \
|
||||||
|
| jq -r --arg n "$FILENAME" '.[] | select(.name == $n) | .id' || true)
|
||||||
|
if [ -n "${OLD_ID:-}" ]; then
|
||||||
|
curl -fsS -X DELETE -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"${API_BASE}/repos/${REPO}/releases/${GITEA_RELEASE_ID}/assets/${OLD_ID}" >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -fsS --max-time 0 --retry 5 --retry-delay 10 \
|
||||||
|
-X POST \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary @"${FILE}" \
|
||||||
|
"${API_BASE}/repos/${REPO}/releases/${GITEA_RELEASE_ID}/assets?name=${FILENAME}" \
|
||||||
|
>/dev/null
|
||||||
|
echo " Gitea: ok"
|
||||||
|
|
||||||
|
OLD_GH=$(curl -fsS -H "Authorization: token ${GH_TOKEN}" \
|
||||||
|
"https://api.github.com/repos/${GITHUB_REPO}/releases/${GH_RELEASE_ID}/assets" \
|
||||||
|
| jq -r --arg n "$FILENAME" '.[] | select(.name == $n) | .id' || true)
|
||||||
|
if [ -n "${OLD_GH:-}" ]; then
|
||||||
|
curl -fsS -X DELETE -H "Authorization: token ${GH_TOKEN}" \
|
||||||
|
"https://api.github.com/repos/${GITHUB_REPO}/releases/assets/${OLD_GH}" >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -fsS --max-time 0 --retry 5 --retry-delay 10 \
|
||||||
|
-X POST \
|
||||||
|
-H "Authorization: token ${GH_TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary @"${FILE}" \
|
||||||
|
"${GH_UPLOAD_URL}?name=${FILENAME}" \
|
||||||
|
>/dev/null
|
||||||
|
echo " GitHub: ok"
|
||||||
|
}
|
||||||
|
|
||||||
|
shopt -s nullglob
|
||||||
|
for FILE in dist-electron/Paarrot-*.AppImage dist-electron/latest-linux.yml; do
|
||||||
|
upload_one "$FILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
finalize-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [increment-version, build-windows, build-linux]
|
needs: [increment-version, prepare-release, build-windows, build-linux]
|
||||||
if: always() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success')
|
if: always() && needs.prepare-release.result == 'success' && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success')
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Cleanup old Gitea releases
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref_name }}
|
|
||||||
|
|
||||||
- name: Pull latest (after version bump)
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
run: git pull origin main
|
|
||||||
|
|
||||||
- name: Get version
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
# Use version from increment-version job if available, otherwise read from file
|
|
||||||
if [ -n "${{ needs.increment-version.outputs.version }}" ]; then
|
|
||||||
VERSION="${{ needs.increment-version.outputs.version }}"
|
|
||||||
else
|
|
||||||
VERSION=$(grep -Po '"version":\s*"\K[^"]+' package.json | head -1)
|
|
||||||
fi
|
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
|
||||||
echo "Version: $VERSION"
|
|
||||||
|
|
||||||
- name: Check if tag exists
|
|
||||||
id: tag_check
|
|
||||||
run: |
|
|
||||||
VERSION="${{ steps.version.outputs.VERSION }}"
|
|
||||||
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
|
||||||
echo "Tag v$VERSION already exists"
|
|
||||||
echo "exists=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "Tag v$VERSION does not exist"
|
|
||||||
echo "exists=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create and push tag
|
|
||||||
if: steps.tag_check.outputs.exists == 'false'
|
|
||||||
run: |
|
|
||||||
git config user.name "GitHub Actions"
|
|
||||||
git config user.email "actions@github.com"
|
|
||||||
git tag -a "v${{ steps.version.outputs.VERSION }}" -m "Release v${{ steps.version.outputs.VERSION }}"
|
|
||||||
git push origin "v${{ steps.version.outputs.VERSION }}"
|
|
||||||
|
|
||||||
- name: Download all artifacts
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
|
|
||||||
- name: Prepare release files
|
|
||||||
run: |
|
|
||||||
mkdir -p release-files
|
|
||||||
find artifacts -type f \( -name "*.exe" -o -name "*.AppImage" -o -name "*.yml" \) -exec cp {} release-files/ \;
|
|
||||||
ls -la release-files/
|
|
||||||
|
|
||||||
- name: Create or Update Release
|
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ steps.version.outputs.VERSION }}"
|
set -euo pipefail
|
||||||
TAG_NAME="v${VERSION}"
|
TAG_NAME="${{ needs.prepare-release.outputs.tag }}"
|
||||||
API_BASE="http://synbox.ruv.wtf:8418/api/v1"
|
API_BASE="${{ github.server_url }}/api/v1"
|
||||||
REPO="litruv/cinny-desktop"
|
REPO="${{ github.repository }}"
|
||||||
|
|
||||||
# Delete old releases (keep only current)
|
echo "Cleaning up old Gitea releases (keeping ${TAG_NAME})..."
|
||||||
echo "Cleaning up old releases..."
|
OLD_RELEASES=$(curl -fsS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
OLD_RELEASES=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
"${API_BASE}/repos/${REPO}/releases" | jq -r --arg t "$TAG_NAME" '.[] | select(.tag_name != $t) | .id')
|
||||||
"${API_BASE}/repos/${REPO}/releases" | jq -r '.[] | select(.tag_name != "'${TAG_NAME}'") | .id')
|
|
||||||
|
|
||||||
for OLD_ID in $OLD_RELEASES; do
|
for OLD_ID in $OLD_RELEASES; do
|
||||||
echo "Deleting old release ${OLD_ID}..."
|
[ -n "$OLD_ID" ] || continue
|
||||||
OLD_TAG=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
OLD_TAG=$(curl -fsS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
"${API_BASE}/repos/${REPO}/releases/${OLD_ID}" | jq -r '.tag_name')
|
"${API_BASE}/repos/${REPO}/releases/${OLD_ID}" | jq -r '.tag_name')
|
||||||
|
echo "Deleting Gitea release ${OLD_ID} (${OLD_TAG})..."
|
||||||
# Delete release
|
curl -fsS -X DELETE -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
curl -s -X DELETE -H "Authorization: token ${GITEA_TOKEN}" \
|
"${API_BASE}/repos/${REPO}/releases/${OLD_ID}" >/dev/null || true
|
||||||
"${API_BASE}/repos/${REPO}/releases/${OLD_ID}"
|
if [ -n "$OLD_TAG" ] && [ "$OLD_TAG" != "null" ]; then
|
||||||
|
curl -fsS -X DELETE -H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
# Delete tag
|
"${API_BASE}/repos/${REPO}/tags/${OLD_TAG}" >/dev/null || true
|
||||||
if [ -n "$OLD_TAG" ]; then
|
|
||||||
echo "Deleting old tag ${OLD_TAG}..."
|
|
||||||
curl -s -X DELETE -H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
"${API_BASE}/repos/${REPO}/tags/${OLD_TAG}"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check if release exists
|
- name: Cleanup old GitHub releases
|
||||||
RELEASE_ID=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
"${API_BASE}/repos/${REPO}/releases/tags/${TAG_NAME}" | jq -r '.id // empty')
|
|
||||||
|
|
||||||
if [ -z "$RELEASE_ID" ]; then
|
|
||||||
echo "Creating new release for ${TAG_NAME}..."
|
|
||||||
RELEASE_ID=$(curl -s -X POST \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"tag_name\": \"${TAG_NAME}\", \"name\": \"Release ${TAG_NAME}\", \"body\": \"Release ${VERSION}\", \"draft\": false, \"prerelease\": false}" \
|
|
||||||
"${API_BASE}/repos/${REPO}/releases" | jq -r '.id')
|
|
||||||
echo "Created release with ID: ${RELEASE_ID}"
|
|
||||||
else
|
|
||||||
echo "Release exists with ID: ${RELEASE_ID}"
|
|
||||||
# Delete existing assets
|
|
||||||
echo "Deleting existing assets..."
|
|
||||||
ASSETS=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
"${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets" | jq -r '.[].id')
|
|
||||||
for ASSET_ID in $ASSETS; do
|
|
||||||
echo "Deleting asset ${ASSET_ID}..."
|
|
||||||
curl -s -X DELETE -H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
"${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Upload new assets
|
|
||||||
echo "Uploading assets..."
|
|
||||||
for FILE in release-files/*; do
|
|
||||||
FILENAME=$(basename "$FILE")
|
|
||||||
echo "Uploading ${FILENAME}..."
|
|
||||||
curl -s -X POST \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
||||||
-H "Content-Type: application/octet-stream" \
|
|
||||||
--data-binary "@${FILE}" \
|
|
||||||
"${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
|
||||||
echo ""
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Release complete!"
|
|
||||||
|
|
||||||
- name: Create GitHub Release
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GHTOKEN }}
|
GH_TOKEN: ${{ secrets.GHTOKEN }}
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ steps.version.outputs.VERSION }}"
|
set -euo pipefail
|
||||||
TAG_NAME="v${VERSION}"
|
TAG_NAME="${{ needs.prepare-release.outputs.tag }}"
|
||||||
GITHUB_REPO="Paarrot/Paarrot-Desktop"
|
GITHUB_REPO="Paarrot/Paarrot-Desktop"
|
||||||
|
|
||||||
# Delete old GitHub releases (keep only current)
|
echo "Cleaning up old GitHub releases (keeping ${TAG_NAME})..."
|
||||||
echo "Cleaning up old GitHub releases..."
|
OLD_RELEASES=$(curl -fsS -H "Authorization: token ${GH_TOKEN}" \
|
||||||
OLD_RELEASES=$(curl -s -H "Authorization: token ${GH_TOKEN}" \
|
"https://api.github.com/repos/${GITHUB_REPO}/releases" | jq -r --arg t "$TAG_NAME" '.[] | select(.tag_name != $t) | .id')
|
||||||
"https://api.github.com/repos/${GITHUB_REPO}/releases" | jq -r '.[] | select(.tag_name != "'${TAG_NAME}'") | .id')
|
|
||||||
|
|
||||||
for OLD_ID in $OLD_RELEASES; do
|
for OLD_ID in $OLD_RELEASES; do
|
||||||
echo "Deleting old GitHub release ${OLD_ID}..."
|
[ -n "$OLD_ID" ] || continue
|
||||||
OLD_TAG=$(curl -s -H "Authorization: token ${GH_TOKEN}" \
|
OLD_TAG=$(curl -fsS -H "Authorization: token ${GH_TOKEN}" \
|
||||||
"https://api.github.com/repos/${GITHUB_REPO}/releases/${OLD_ID}" | jq -r '.tag_name')
|
"https://api.github.com/repos/${GITHUB_REPO}/releases/${OLD_ID}" | jq -r '.tag_name')
|
||||||
|
echo "Deleting GitHub release ${OLD_ID} (${OLD_TAG})..."
|
||||||
# Delete release
|
curl -fsS -X DELETE -H "Authorization: token ${GH_TOKEN}" \
|
||||||
curl -s -X DELETE -H "Authorization: token ${GH_TOKEN}" \
|
"https://api.github.com/repos/${GITHUB_REPO}/releases/${OLD_ID}" >/dev/null || true
|
||||||
"https://api.github.com/repos/${GITHUB_REPO}/releases/${OLD_ID}"
|
if [ -n "$OLD_TAG" ] && [ "$OLD_TAG" != "null" ]; then
|
||||||
|
curl -fsS -X DELETE -H "Authorization: token ${GH_TOKEN}" \
|
||||||
# Delete tag
|
"https://api.github.com/repos/${GITHUB_REPO}/git/refs/tags/${OLD_TAG}" >/dev/null || true
|
||||||
if [ -n "$OLD_TAG" ]; then
|
|
||||||
echo "Deleting old GitHub tag ${OLD_TAG}..."
|
|
||||||
curl -s -X DELETE -H "Authorization: token ${GH_TOKEN}" \
|
|
||||||
"https://api.github.com/repos/${GITHUB_REPO}/git/refs/tags/${OLD_TAG}"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check if release exists on GitHub
|
echo "Release finalize complete for ${TAG_NAME}"
|
||||||
RELEASE_ID=$(curl -s -H "Authorization: token ${GH_TOKEN}" \
|
|
||||||
"https://api.github.com/repos/${GITHUB_REPO}/releases/tags/${TAG_NAME}" | jq -r '.id // empty')
|
|
||||||
|
|
||||||
if [ -z "$RELEASE_ID" ]; then
|
|
||||||
echo "Creating new GitHub release for ${TAG_NAME}..."
|
|
||||||
RELEASE_ID=$(curl -s -X POST \
|
|
||||||
-H "Authorization: token ${GH_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"tag_name\": \"${TAG_NAME}\", \"name\": \"Release ${TAG_NAME}\", \"body\": \"Release ${VERSION}\", \"draft\": false, \"prerelease\": false}" \
|
|
||||||
"https://api.github.com/repos/${GITHUB_REPO}/releases" | jq -r '.id')
|
|
||||||
echo "Created GitHub release with ID: ${RELEASE_ID}"
|
|
||||||
else
|
|
||||||
echo "GitHub release exists with ID: ${RELEASE_ID}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Upload assets to GitHub
|
|
||||||
echo "Uploading assets to GitHub..."
|
|
||||||
UPLOAD_URL=$(curl -s -H "Authorization: token ${GH_TOKEN}" \
|
|
||||||
"https://api.github.com/repos/${GITHUB_REPO}/releases/${RELEASE_ID}" | jq -r '.upload_url' | sed 's/{?name,label}//')
|
|
||||||
|
|
||||||
for FILE in release-files/*; do
|
|
||||||
FILENAME=$(basename "$FILE")
|
|
||||||
echo "Uploading ${FILENAME} to GitHub..."
|
|
||||||
curl -s -X POST \
|
|
||||||
-H "Authorization: token ${GH_TOKEN}" \
|
|
||||||
-H "Content-Type: application/octet-stream" \
|
|
||||||
--data-binary "@${FILE}" \
|
|
||||||
"${UPLOAD_URL}?name=${FILENAME}"
|
|
||||||
echo ""
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "GitHub release complete!"
|
|
||||||
|
|||||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
|||||||
[submodule "cinny"]
|
[submodule "cinny"]
|
||||||
path = cinny
|
path = cinny
|
||||||
url = http://synbox.ruv.wtf:8418/litruv/cinny.git
|
url = ../cinny.git
|
||||||
|
|||||||
2
cinny
2
cinny
Submodule cinny updated: f62200ecd1...99a294791e
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "paarrot",
|
"name": "paarrot",
|
||||||
"version": "4.11.163",
|
"version": "4.11.168",
|
||||||
"description": "Paarrot - A Matrix client based on Cinny",
|
"description": "Paarrot - A Matrix client based on Cinny",
|
||||||
"homepage": "https://github.com/Paarrot/Paarrot-Desktop",
|
"homepage": "https://github.com/Paarrot/Paarrot-Desktop",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user