Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7c143788b | ||
|
|
ef64be8da6 |
@@ -4,20 +4,30 @@ const path = require('node:path');
|
||||
function releaseEnvironment(context) {
|
||||
const env = context.env ?? process.env;
|
||||
const serverUrl = env.GITEA_URL?.replace(/\/$/, '');
|
||||
const publicUrl = env.GITEA_PUBLIC_URL?.replace(/\/$/, '');
|
||||
const repository = env.GITEA_REPOSITORY;
|
||||
const token = env.GITEA_TOKEN;
|
||||
|
||||
if (!serverUrl || !repository || !token) {
|
||||
throw new Error('GITEA_URL, GITEA_REPOSITORY, and GITEA_TOKEN are required');
|
||||
if (!serverUrl || !publicUrl || !repository || !token) {
|
||||
throw new Error(
|
||||
'GITEA_URL, GITEA_PUBLIC_URL, GITEA_REPOSITORY, and GITEA_TOKEN are required',
|
||||
);
|
||||
}
|
||||
if (!/^https?:\/\//.test(serverUrl)) {
|
||||
throw new Error('GITEA_URL must be an HTTP(S) URL');
|
||||
}
|
||||
if (!/^https?:\/\//.test(publicUrl)) {
|
||||
throw new Error('GITEA_PUBLIC_URL must be an HTTP(S) URL');
|
||||
}
|
||||
if (!/^[^/]+\/[^/]+$/.test(repository)) {
|
||||
throw new Error('GITEA_REPOSITORY must use the owner/repository format');
|
||||
}
|
||||
|
||||
return { serverUrl, repository, token };
|
||||
return { serverUrl, publicUrl, repository, token };
|
||||
}
|
||||
|
||||
function makeUrlsPublic(value, serverUrl, publicUrl) {
|
||||
return value?.split(serverUrl).join(publicUrl);
|
||||
}
|
||||
|
||||
async function giteaRequest(url, token, options = {}) {
|
||||
@@ -43,10 +53,11 @@ module.exports.verifyConditions = async (_pluginConfig, context) => {
|
||||
|
||||
module.exports.prepare = async (pluginConfig, context) => {
|
||||
const { nextRelease, cwd } = context;
|
||||
const notes = nextRelease.notes?.trim();
|
||||
if (!notes) return;
|
||||
const rawNotes = nextRelease.notes?.trim();
|
||||
if (!rawNotes) return;
|
||||
|
||||
const { serverUrl, repository } = releaseEnvironment(context);
|
||||
const { serverUrl, publicUrl, repository } = releaseEnvironment(context);
|
||||
const notes = makeUrlsPublic(rawNotes, serverUrl, publicUrl);
|
||||
const changelogPath = path.resolve(cwd, pluginConfig.changelogFile ?? 'CHANGELOG.md');
|
||||
const releaseJsonPath = path.resolve(cwd, pluginConfig.releaseJsonPath ?? 'patches-bundle.json');
|
||||
|
||||
@@ -67,7 +78,7 @@ module.exports.prepare = async (pluginConfig, context) => {
|
||||
const releaseData = {
|
||||
created_at: new Date().toISOString().replace(/\.\d{3}Z$/, ''),
|
||||
description: notes,
|
||||
download_url: `${serverUrl}/${repository}/releases/download/${nextRelease.gitTag}/${assetName}`,
|
||||
download_url: `${publicUrl}/${repository}/releases/download/${nextRelease.gitTag}/${assetName}`,
|
||||
signature_download_url: '',
|
||||
version,
|
||||
};
|
||||
@@ -75,7 +86,7 @@ module.exports.prepare = async (pluginConfig, context) => {
|
||||
};
|
||||
|
||||
module.exports.publish = async (pluginConfig, context) => {
|
||||
const { serverUrl, repository, token } = releaseEnvironment(context);
|
||||
const { serverUrl, publicUrl, repository, token } = releaseEnvironment(context);
|
||||
const { branch, cwd, nextRelease } = context;
|
||||
const repositoryPath = repository.split('/').map(encodeURIComponent).join('/');
|
||||
const apiUrl = `${serverUrl}/api/v1/repos/${repositoryPath}`;
|
||||
@@ -96,7 +107,7 @@ module.exports.publish = async (pluginConfig, context) => {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
body: nextRelease.notes,
|
||||
body: makeUrlsPublic(nextRelease.notes, serverUrl, publicUrl),
|
||||
draft: false,
|
||||
name: nextRelease.name,
|
||||
prerelease: false,
|
||||
|
||||
@@ -52,6 +52,7 @@ jobs:
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GITEA_URL: ${{ gitea.server_url }}
|
||||
GITEA_PUBLIC_URL: https://git.krtss.de
|
||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||
GITEA_REF_NAME: ${{ gitea.ref_name }}
|
||||
run: npx semantic-release
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
[
|
||||
"@semantic-release/exec",
|
||||
{
|
||||
"prepareCmd": "./gradlew generatePatchesList && jq '.version=\"${nextRelease.version}\"' patches-list.json > patches-list.json.tmp && mv patches-list.json.tmp patches-list.json && python3 .gitea/scripts/generate_patches_readme.py \"$GITEA_URL\" \"$GITEA_REPOSITORY\" \"$GITEA_REF_NAME\" patches-list.json README.md"
|
||||
"prepareCmd": "./gradlew generatePatchesList && jq '.version=\"${nextRelease.version}\"' patches-list.json > patches-list.json.tmp && mv patches-list.json.tmp patches-list.json && python3 .gitea/scripts/generate_patches_readme.py \"$GITEA_PUBLIC_URL\" \"$GITEA_REPOSITORY\" \"$GITEA_REF_NAME\" patches-list.json README.md"
|
||||
}
|
||||
],
|
||||
[
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
## [1.0.2](https://git.krtss.de/StanPonomarev/twitter-patch/compare/v1.0.1...v1.0.2) (2026-08-21)
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
* release again ([ef64be8](https://git.krtss.de/StanPonomarev/twitter-patch/commit/ef64be8da665680ebf9fadcf60ae79046594292d))
|
||||
|
||||
## [1.0.1](http://gitea:3000/StanPonomarev/twitter-patch/compare/v1.0.0...v1.0.1) (2026-08-21)
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
@@ -4,7 +4,7 @@ Patch bundle for X (Twitter), maintained by
|
||||
[Stan Ponomarev](https://git.krtss.de/StanPonomarev).
|
||||
|
||||
<!-- PATCHES_START -->
|
||||
> **[v1.0.1](http://gitea:3000/StanPonomarev/twitter-patch/releases/tag/v1.0.1)** • `main` • 1 patches total
|
||||
> **[v1.0.2](https://git.krtss.de/StanPonomarev/twitter-patch/releases/tag/v1.0.2)** • `main` • 1 patches total
|
||||
<details open>
|
||||
<summary>📦 X • 1 patch</summary>
|
||||
<br>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 1.0.1
|
||||
version = 1.0.2
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"created_at": "2026-08-21T15:07:17",
|
||||
"description": "## [1.0.1](http://gitea:3000/StanPonomarev/twitter-patch/compare/v1.0.0...v1.0.1) (2026-08-21)\n\n### 🐛 Bug Fixes\n\n* update release strat ([818e291](http://gitea:3000/StanPonomarev/twitter-patch/commit/818e291ffdfa17eff5f57e9a47e3f73a00b7c050))",
|
||||
"download_url": "http://gitea:3000/StanPonomarev/twitter-patch/releases/download/v1.0.1/patches-1.0.1.mpp",
|
||||
"created_at": "2026-08-21T15:48:15",
|
||||
"description": "## [1.0.2](https://git.krtss.de/StanPonomarev/twitter-patch/compare/v1.0.1...v1.0.2) (2026-08-21)\n\n### 🐛 Bug Fixes\n\n* release again ([ef64be8](https://git.krtss.de/StanPonomarev/twitter-patch/commit/ef64be8da665680ebf9fadcf60ae79046594292d))",
|
||||
"download_url": "https://git.krtss.de/StanPonomarev/twitter-patch/releases/download/v1.0.2/patches-1.0.2.mpp",
|
||||
"signature_download_url": "",
|
||||
"version": "1.0.1"
|
||||
"version": "1.0.2"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"NOTE": "Do NOT manually edit this file. This file is automatically updated when semantic release (release.yml) runs. Manually editing this file can break your releases and break third party tools that use this file.",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"patches": [
|
||||
{
|
||||
"name": "Disable outdated version screen",
|
||||
|
||||
Reference in New Issue
Block a user