Change release - don't publish the XPI but a readme instead
This commit is contained in:
@@ -19,11 +19,10 @@ jobs:
|
||||
- name: Validate versions and signed XPI
|
||||
id: release
|
||||
run: |
|
||||
python3 scripts/release/validate_release.py
|
||||
version=$(python3 -c "import json; print(json.load(open('frontend/version.json'))['version'])")
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
if [ "${GITHUB_REF_NAME#v}" != "$version" ]; then
|
||||
echo "tag ${GITHUB_REF_NAME} does not match release version $version" >&2
|
||||
python3 scripts/release/validate_release.py --github-output "$GITHUB_OUTPUT"
|
||||
backend_version=$(python3 -c "import re; text=open('backend/app/core/config.py').read(); print(re.search(r\"version: str = os\\.getenv\\('LINKLOG_VERSION', '([^']+)'\\)\", text).group(1))")
|
||||
if [ "${GITHUB_REF_NAME#v}" != "$backend_version" ]; then
|
||||
echo "tag ${GITHUB_REF_NAME} does not match backend version $backend_version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -40,25 +39,75 @@ jobs:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.IMAGE_NAME }}:${{ steps.release.outputs.version }}
|
||||
${{ env.IMAGE_NAME }}:${{ steps.release.outputs.backend_version }}
|
||||
${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.version=${{ steps.release.outputs.version }}
|
||||
org.opencontainers.image.version=${{ steps.release.outputs.backend_version }}
|
||||
org.opencontainers.image.source=https://git.kolkman.org/olaf/Link-Log
|
||||
|
||||
- name: Generate release README
|
||||
env:
|
||||
BACKEND_VERSION: ${{ steps.release.outputs.backend_version }}
|
||||
PLUGIN_VERSION: ${{ steps.release.outputs.plugin_version }}
|
||||
SIGNED_XPI: ${{ steps.release.outputs.signed_xpi }}
|
||||
run: |
|
||||
cat > release-readme.md <<EOF
|
||||
# LinkLog $BACKEND_VERSION
|
||||
|
||||
LinkLog is a Firefox extension and Python web service for saving links with a title, comment, timestamp, and tracking parameters removed. The service stores links in SQLite and can publish them through plugins, including Mastodon.
|
||||
|
||||
## Docker Container
|
||||
|
||||
The current backend/container version is $BACKEND_VERSION. Pull it from the Gitea container registry:
|
||||
|
||||
\`\`\`sh
|
||||
docker pull $IMAGE_NAME:$BACKEND_VERSION
|
||||
\`\`\`
|
||||
|
||||
The same image is also published as:
|
||||
|
||||
\`\`\`sh
|
||||
docker pull $IMAGE_NAME:latest
|
||||
\`\`\`
|
||||
The developer version of the backend is always published as $IMAGE_NAME:latest, which may be ahead of the current release version and may be unstable.
|
||||
Additional information about the backend can be found in the [README](https://git.kolkman.org/olaf/Link-Log/src/branch/main/backend/README.md).
|
||||
|
||||
## Firefox Extension
|
||||
|
||||
The current signed Firefox plugin version, compatible with this version of the backend, is $PLUGIN_VERSION. Download it from the raw repository artifact:
|
||||
|
||||
https://git.kolkman.org/olaf/Link-Log/raw/branch/main/$SIGNED_XPI
|
||||
EOF
|
||||
|
||||
- name: Create Gitea release
|
||||
id: gitea_release
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
VERSION: ${{ steps.release.outputs.version }}
|
||||
VERSION: ${{ steps.release.outputs.backend_version }}
|
||||
run: |
|
||||
payload_file=$(mktemp)
|
||||
python3 - <<'PY' > "$payload_file"
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
version = os.environ['VERSION']
|
||||
print(json.dumps({
|
||||
'tag_name': f'v{version}',
|
||||
'name': f'LinkLog {version}',
|
||||
'body': Path('release-readme.md').read_text(),
|
||||
'draft': False,
|
||||
'prerelease': False,
|
||||
}))
|
||||
PY
|
||||
response_file=$(mktemp)
|
||||
response_status=$(curl --silent --show-error -o "$response_file" -w '%{http_code}' \
|
||||
-X POST \
|
||||
-H "Authorization: token $RELEASE_TOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{\"tag_name\":\"v$VERSION\",\"name\":\"LinkLog $VERSION\",\"draft\":false,\"prerelease\":false}" \
|
||||
--data-binary "@$payload_file" \
|
||||
https://git.kolkman.org/api/v1/repos/olaf/Link-Log/releases)
|
||||
rm -f "$payload_file"
|
||||
if [ "$response_status" = 409 ]; then
|
||||
response_status=$(curl --silent --show-error -o "$response_file" -w '%{http_code}' \
|
||||
-H "Authorization: token $RELEASE_TOKEN" \
|
||||
@@ -76,35 +125,27 @@ jobs:
|
||||
upload_url="https://git.kolkman.org/api/v1/repos/olaf/Link-Log/releases/$release_id/assets"
|
||||
echo "upload_url=$upload_url" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload signed XPI and update manifest
|
||||
- name: Upload release README
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
UPLOAD_URL: ${{ steps.gitea_release.outputs.upload_url }}
|
||||
VERSION: ${{ steps.release.outputs.version }}
|
||||
run: |
|
||||
response_status=$(curl --silent --show-error -o /tmp/linklog-xpi-upload-response -w '%{http_code}' \
|
||||
response_status=$(curl --silent --show-error -o /tmp/linklog-readme-upload-response -w '%{http_code}' \
|
||||
-X POST -H "Authorization: token $RELEASE_TOKEN" \
|
||||
-H 'Content-Type: application/x-xpinstall' \
|
||||
--data-binary "@XPI/signed/LinkLog-$VERSION.xpi" \
|
||||
"$UPLOAD_URL?name=LinkLog-$VERSION.xpi")
|
||||
-H 'Content-Type: text/markdown' \
|
||||
--data-binary @release-readme.md \
|
||||
"$UPLOAD_URL?name=README.md")
|
||||
if [ "$response_status" -lt 200 ] || [ "$response_status" -ge 300 ]; then
|
||||
cat /tmp/linklog-xpi-upload-response >&2
|
||||
exit 1
|
||||
fi
|
||||
response_status=$(curl --silent --show-error -o /tmp/linklog-updates-upload-response -w '%{http_code}' \
|
||||
-X POST -H "Authorization: token $RELEASE_TOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary @webextension/updates.json \
|
||||
"$UPLOAD_URL?name=updates.json")
|
||||
if [ "$response_status" -lt 200 ] || [ "$response_status" -ge 300 ]; then
|
||||
cat /tmp/linklog-updates-upload-response >&2
|
||||
cat /tmp/linklog-readme-upload-response >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Publish release links
|
||||
env:
|
||||
VERSION: ${{ steps.release.outputs.version }}
|
||||
BACKEND_VERSION: ${{ steps.release.outputs.backend_version }}
|
||||
PLUGIN_VERSION: ${{ steps.release.outputs.plugin_version }}
|
||||
SIGNED_XPI: ${{ steps.release.outputs.signed_xpi }}
|
||||
run: |
|
||||
echo "Docker image: $IMAGE_NAME:$VERSION"
|
||||
echo "Signed XPI: https://git.kolkman.org/olaf/Link-Log/releases/download/v$VERSION/LinkLog-$VERSION.xpi"
|
||||
echo "Firefox update manifest: https://git.kolkman.org/olaf/Link-Log/raw/branch/main/webextension/updates.json"
|
||||
echo "Docker image: $IMAGE_NAME:$BACKEND_VERSION"
|
||||
echo "Signed XPI: https://git.kolkman.org/olaf/Link-Log/raw/branch/main/$SIGNED_XPI (version $PLUGIN_VERSION)"
|
||||
echo "Release README: README.md"
|
||||
|
||||
Reference in New Issue
Block a user