You've already forked CS-Box
Compare commits
9 Commits
01ae039b17
...
main-29-c9
| Author | SHA1 | Date | |
|---|---|---|---|
| c9402db818 | |||
|
|
9b065f7cce | ||
| 82654d9489 | |||
|
|
064cf7df4f | ||
| 2ce3407d22 | |||
|
|
a0d4b44364 | ||
| 360f01051d | |||
|
|
2d2491f469 | ||
| 862316dc1c |
@@ -8,13 +8,14 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout (full history + tags)
|
- name: Checkout (full history + tags)
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install git-cliff (no GitHub API)
|
- name: Install git-cliff
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
@@ -25,52 +26,52 @@ jobs:
|
|||||||
sudo install /tmp/git-cliff-*/git-cliff /usr/local/bin/git-cliff
|
sudo install /tmp/git-cliff-*/git-cliff /usr/local/bin/git-cliff
|
||||||
git-cliff --version
|
git-cliff --version
|
||||||
|
|
||||||
- name: Generate release notes (Keep a Changelog)
|
- name: Generate release notes
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
# This generates a full changelog doc; we’ll use it as the release body.
|
|
||||||
git-cliff --config cliff.toml --output RELEASE_NOTES.md
|
git-cliff --config cliff.toml --output RELEASE_NOTES.md
|
||||||
|
|
||||||
# (Optional) Trim header if you only want entries (keep as-is if you prefer full text)
|
|
||||||
# For now we use the full generated content.
|
|
||||||
test -s RELEASE_NOTES.md
|
test -s RELEASE_NOTES.md
|
||||||
|
|
||||||
- name: Prepare tag + locate zip
|
- name: Create export zip (Computing:Box Website.zip)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
if [ ! -d "export" ]; then
|
||||||
# Your exported zip file in the repository
|
echo "❌ export/ folder not found in repo root"
|
||||||
ZIP_PATH="Computing:Box Website.zip"
|
|
||||||
if [ ! -f "$ZIP_PATH" ]; then
|
|
||||||
echo "❌ Expected zip not found: $ZIP_PATH"
|
|
||||||
echo "Files in repo root:"
|
|
||||||
ls -la
|
ls -la
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a unique tag for every commit to main
|
# Create the zip with the exact requested display name
|
||||||
|
rm -f "Computing:Box Website.zip"
|
||||||
|
(cd export && zip -r "../Computing:Box Website.zip" .)
|
||||||
|
test -s "Computing:Box Website.zip"
|
||||||
|
ls -lh "Computing:Box Website.zip"
|
||||||
|
|
||||||
|
- name: Prepare tag
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
SHORT_SHA="$(git rev-parse --short HEAD)"
|
SHORT_SHA="$(git rev-parse --short HEAD)"
|
||||||
RUN_NO="${GITHUB_RUN_NUMBER:-0}"
|
RUN_NO="${GITHUB_RUN_NUMBER:-0}"
|
||||||
TAG="v1.9-${RUN_NO}-${SHORT_SHA}"
|
TAG="main-${RUN_NO}-${SHORT_SHA}"
|
||||||
|
|
||||||
echo "TAG=$TAG" >> $GITHUB_ENV
|
echo "TAG=$TAG" >> "$GITHUB_ENV"
|
||||||
echo "ZIP_PATH=$ZIP_PATH" >> $GITHUB_ENV
|
echo "ZIP_PATH=Computing:Box Website.zip" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Create and push tag (uses RELEASE_PAT)
|
- name: Create and push tag (Gitea PAT)
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
RELEASE_PAT: ${{ secrets.CHANGELOG_PAT }}
|
RELEASE_PAT: ${{ secrets.CHANGELOG_PAT}}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Tag the current commit
|
|
||||||
git tag -f "$TAG"
|
git tag -f "$TAG"
|
||||||
|
|
||||||
origin_url="$(git remote get-url origin)"
|
origin_url="$(git remote get-url origin)"
|
||||||
|
|
||||||
# Convert SSH origin to HTTPS if needed (git@host:owner/repo -> https://host/owner/repo)
|
# Convert SSH origin to HTTPS if needed
|
||||||
if echo "$origin_url" | grep -q "^git@"; then
|
if echo "$origin_url" | grep -q "^git@"; then
|
||||||
host="$(echo "$origin_url" | sed -E 's#git@([^:]+):.*#\1#')"
|
host="$(echo "$origin_url" | sed -E 's#git@([^:]+):.*#\1#')"
|
||||||
path="$(echo "$origin_url" | sed -E 's#git@[^:]+:(.*)#\1#')"
|
path="$(echo "$origin_url" | sed -E 's#git@[^:]+:(.*)#\1#')"
|
||||||
@@ -78,18 +79,15 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
authed_url="$(echo "$origin_url" | sed -E "s#^https://#https://oauth2:${RELEASE_PAT}@#")"
|
authed_url="$(echo "$origin_url" | sed -E "s#^https://#https://oauth2:${RELEASE_PAT}@#")"
|
||||||
|
|
||||||
# Push the tag
|
|
||||||
git push "$authed_url" "refs/tags/$TAG" --force
|
git push "$authed_url" "refs/tags/$TAG" --force
|
||||||
|
|
||||||
- name: Create release + upload asset to Gitea
|
- name: Create release + upload asset
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
RELEASE_PAT: ${{ secrets.CHANGELOG_PAT }}
|
RELEASE_PAT: ${{ secrets.CHANGELOG_PAT}}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Derive base URL + owner/repo from origin
|
|
||||||
origin_url="$(git remote get-url origin)"
|
origin_url="$(git remote get-url origin)"
|
||||||
if echo "$origin_url" | grep -q "^git@"; then
|
if echo "$origin_url" | grep -q "^git@"; then
|
||||||
host="$(echo "$origin_url" | sed -E 's#git@([^:]+):.*#\1#')"
|
host="$(echo "$origin_url" | sed -E 's#git@([^:]+):.*#\1#')"
|
||||||
@@ -99,7 +97,6 @@ jobs:
|
|||||||
|
|
||||||
base="$(echo "$origin_url" | sed -E 's#(https?://[^/]+)/.*#\1#')"
|
base="$(echo "$origin_url" | sed -E 's#(https?://[^/]+)/.*#\1#')"
|
||||||
repo_path="$(echo "$origin_url" | sed -E 's#https?://[^/]+/##')"
|
repo_path="$(echo "$origin_url" | sed -E 's#https?://[^/]+/##')"
|
||||||
# Remove trailing .git if present
|
|
||||||
repo_path="$(echo "$repo_path" | sed -E 's/\.git$//')"
|
repo_path="$(echo "$repo_path" | sed -E 's/\.git$//')"
|
||||||
|
|
||||||
owner="$(echo "$repo_path" | cut -d/ -f1)"
|
owner="$(echo "$repo_path" | cut -d/ -f1)"
|
||||||
@@ -107,58 +104,52 @@ jobs:
|
|||||||
|
|
||||||
api="$base/api/v1"
|
api="$base/api/v1"
|
||||||
|
|
||||||
# Build release body (escape as JSON safely)
|
# Build release JSON payload to a file
|
||||||
body_json="$(python3 - << 'PY'
|
python3 - <<'PY'
|
||||||
import json
|
import json, os
|
||||||
with open("RELEASE_NOTES.md","r",encoding="utf-8") as f:
|
tag = os.environ["TAG"]
|
||||||
txt = f.read()
|
with open("RELEASE_NOTES.md", "r", encoding="utf-8") as f:
|
||||||
print(json.dumps(txt))
|
body = f.read()
|
||||||
PY
|
|
||||||
)"
|
|
||||||
|
|
||||||
# Create release
|
payload = {
|
||||||
payload="$(python3 - << PY
|
"tag_name": tag,
|
||||||
import json
|
"target_commitish": "main",
|
||||||
print(json.dumps({
|
"name": tag,
|
||||||
"tag_name": "${TAG}",
|
"body": body,
|
||||||
"target_commitish": "main",
|
"draft": False,
|
||||||
"name": "${TAG}",
|
"prerelease": False,
|
||||||
"body": json.loads(${body_json}),
|
}
|
||||||
"draft": False,
|
|
||||||
"prerelease": False
|
|
||||||
}))
|
|
||||||
PY
|
|
||||||
)"
|
|
||||||
|
|
||||||
release_resp="$(curl -sS -X POST \
|
with open("release.json", "w", encoding="utf-8") as f:
|
||||||
-H "Authorization: token ${CHANGELOG_PAT}" \
|
json.dump(payload, f)
|
||||||
|
PY
|
||||||
|
|
||||||
|
# Create the release
|
||||||
|
curl -sS -X POST \
|
||||||
|
-H "Authorization: token ${RELEASE_PAT}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"${api}/repos/${owner}/${repo}/releases" \
|
"${api}/repos/${owner}/${repo}/releases" \
|
||||||
-d "${payload}")"
|
--data-binary @release.json \
|
||||||
|
-o release_response.json
|
||||||
release_id="$(python3 - << 'PY'
|
|
||||||
import json,sys
|
|
||||||
data=json.loads(sys.stdin.read())
|
|
||||||
rid=data.get("id")
|
|
||||||
if not rid:
|
|
||||||
print("NO_ID")
|
|
||||||
print(json.dumps(data, indent=2))
|
|
||||||
sys.exit(1)
|
|
||||||
print(rid)
|
|
||||||
PY
|
|
||||||
<<EOF
|
|
||||||
$release_resp
|
|
||||||
EOF
|
|
||||||
)"
|
|
||||||
|
|
||||||
|
# Extract release id
|
||||||
|
release_id="$(python3 - <<'PY'
|
||||||
|
import json
|
||||||
|
with open("release_response.json","r",encoding="utf-8") as f:
|
||||||
|
data=json.load(f)
|
||||||
|
rid=data.get("id")
|
||||||
|
if not rid:
|
||||||
|
raise SystemExit("No release id returned. Response:\n" + json.dumps(data, indent=2))
|
||||||
|
print(rid)
|
||||||
|
PY
|
||||||
|
)"
|
||||||
echo "Created release id: $release_id"
|
echo "Created release id: $release_id"
|
||||||
|
|
||||||
# Upload asset (multipart/form-data)
|
# Upload asset (display name exactly "Computing:Box Website.zip")
|
||||||
# Use a filename that matches what you want users to see in the release.
|
|
||||||
curl -sS -X POST \
|
curl -sS -X POST \
|
||||||
-H "Authorization: token ${CHANGELOG_PAT}" \
|
-H "Authorization: token ${RELEASE_PAT}" \
|
||||||
"${api}/repos/${owner}/${repo}/releases/${release_id}/assets?name=Computing%3ABox%20Website.zip" \
|
"${api}/repos/${owner}/${repo}/releases/${release_id}/assets?name=Computing%3ABox%20Website.zip" \
|
||||||
-F "attachment=@${ZIP_PATH}" \
|
-F "attachment=@${ZIP_PATH}" \
|
||||||
>/dev/null
|
>/dev/null
|
||||||
|
|
||||||
echo "✅ Release created and asset uploaded: ${TAG}"
|
echo "✅ Release created: ${TAG} (asset uploaded)"
|
||||||
|
|||||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -9,6 +9,20 @@ and this project adheres to [Conventional Commits](https://www.conventionalcommi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
|
||||||
|
- update changelog [skip ci]
|
||||||
|
|
||||||
|
- update changelog [skip ci]
|
||||||
|
|
||||||
|
- update changelog [skip ci]
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.9] - 2025-12-26
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|
||||||
@@ -46,6 +60,8 @@ and this project adheres to [Conventional Commits](https://www.conventionalcommi
|
|||||||
|
|
||||||
- v1.9
|
- v1.9
|
||||||
|
|
||||||
|
- update changelog [skip ci]
|
||||||
|
|
||||||
|
|
||||||
### Reverted
|
### Reverted
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user