Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7c143788b | ||
|
|
ef64be8da6 | ||
|
|
98aa1e9e1f | ||
|
|
818e291ffd |
@@ -4,20 +4,30 @@ const path = require('node:path');
|
|||||||
function releaseEnvironment(context) {
|
function releaseEnvironment(context) {
|
||||||
const env = context.env ?? process.env;
|
const env = context.env ?? process.env;
|
||||||
const serverUrl = env.GITEA_URL?.replace(/\/$/, '');
|
const serverUrl = env.GITEA_URL?.replace(/\/$/, '');
|
||||||
|
const publicUrl = env.GITEA_PUBLIC_URL?.replace(/\/$/, '');
|
||||||
const repository = env.GITEA_REPOSITORY;
|
const repository = env.GITEA_REPOSITORY;
|
||||||
const token = env.GITEA_TOKEN;
|
const token = env.GITEA_TOKEN;
|
||||||
|
|
||||||
if (!serverUrl || !repository || !token) {
|
if (!serverUrl || !publicUrl || !repository || !token) {
|
||||||
throw new Error('GITEA_URL, GITEA_REPOSITORY, and GITEA_TOKEN are required');
|
throw new Error(
|
||||||
|
'GITEA_URL, GITEA_PUBLIC_URL, GITEA_REPOSITORY, and GITEA_TOKEN are required',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!/^https?:\/\//.test(serverUrl)) {
|
if (!/^https?:\/\//.test(serverUrl)) {
|
||||||
throw new Error('GITEA_URL must be an HTTP(S) URL');
|
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)) {
|
if (!/^[^/]+\/[^/]+$/.test(repository)) {
|
||||||
throw new Error('GITEA_REPOSITORY must use the owner/repository format');
|
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 = {}) {
|
async function giteaRequest(url, token, options = {}) {
|
||||||
@@ -43,10 +53,11 @@ module.exports.verifyConditions = async (_pluginConfig, context) => {
|
|||||||
|
|
||||||
module.exports.prepare = async (pluginConfig, context) => {
|
module.exports.prepare = async (pluginConfig, context) => {
|
||||||
const { nextRelease, cwd } = context;
|
const { nextRelease, cwd } = context;
|
||||||
const notes = nextRelease.notes?.trim();
|
const rawNotes = nextRelease.notes?.trim();
|
||||||
if (!notes) return;
|
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 changelogPath = path.resolve(cwd, pluginConfig.changelogFile ?? 'CHANGELOG.md');
|
||||||
const releaseJsonPath = path.resolve(cwd, pluginConfig.releaseJsonPath ?? 'patches-bundle.json');
|
const releaseJsonPath = path.resolve(cwd, pluginConfig.releaseJsonPath ?? 'patches-bundle.json');
|
||||||
|
|
||||||
@@ -67,7 +78,7 @@ module.exports.prepare = async (pluginConfig, context) => {
|
|||||||
const releaseData = {
|
const releaseData = {
|
||||||
created_at: new Date().toISOString().replace(/\.\d{3}Z$/, ''),
|
created_at: new Date().toISOString().replace(/\.\d{3}Z$/, ''),
|
||||||
description: notes,
|
description: notes,
|
||||||
download_url: `${serverUrl}/${repository}/releases/download/${nextRelease.gitTag}/${assetName}`,
|
download_url: `${publicUrl}/${repository}/releases/download/${nextRelease.gitTag}/${assetName}`,
|
||||||
signature_download_url: '',
|
signature_download_url: '',
|
||||||
version,
|
version,
|
||||||
};
|
};
|
||||||
@@ -75,7 +86,7 @@ module.exports.prepare = async (pluginConfig, context) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports.publish = 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 { branch, cwd, nextRelease } = context;
|
||||||
const repositoryPath = repository.split('/').map(encodeURIComponent).join('/');
|
const repositoryPath = repository.split('/').map(encodeURIComponent).join('/');
|
||||||
const apiUrl = `${serverUrl}/api/v1/repos/${repositoryPath}`;
|
const apiUrl = `${serverUrl}/api/v1/repos/${repositoryPath}`;
|
||||||
@@ -96,10 +107,10 @@ module.exports.publish = async (pluginConfig, context) => {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
body: nextRelease.notes,
|
body: makeUrlsPublic(nextRelease.notes, serverUrl, publicUrl),
|
||||||
draft: false,
|
draft: false,
|
||||||
name: nextRelease.name,
|
name: nextRelease.name,
|
||||||
prerelease: Boolean(branch.prerelease),
|
prerelease: false,
|
||||||
tag_name: nextRelease.gitTag,
|
tag_name: nextRelease.gitTag,
|
||||||
target_commitish: branch.name,
|
target_commitish: branch.name,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
name: Open a PR to main
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
pull-request:
|
|
||||||
name: Open pull request
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Open pull request
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
GITEA_URL: ${{ gitea.server_url }}
|
|
||||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
|
||||||
SOURCE_BRANCH: ${{ gitea.ref_name }}
|
|
||||||
TARGET_BRANCH: main
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
api_url="${GITEA_URL%/}/api/v1"
|
|
||||||
auth_header="Authorization: token ${GITEA_TOKEN}"
|
|
||||||
|
|
||||||
open_pulls="$(
|
|
||||||
curl --fail-with-body --silent --show-error \
|
|
||||||
--get \
|
|
||||||
--header "$auth_header" \
|
|
||||||
--data-urlencode "state=open" \
|
|
||||||
--data-urlencode "base_branch=${TARGET_BRANCH}" \
|
|
||||||
--data-urlencode "limit=50" \
|
|
||||||
"${api_url}/repos/${GITEA_REPOSITORY}/pulls"
|
|
||||||
)"
|
|
||||||
if jq -e --arg branch "$SOURCE_BRANCH" \
|
|
||||||
'any(.[]; .head.ref == $branch)' <<<"$open_pulls" >/dev/null; then
|
|
||||||
echo "Pull request already exists."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
commits="$(git rev-list --count "origin/${TARGET_BRANCH}..HEAD")"
|
|
||||||
if [[ "$commits" -eq 0 ]]; then
|
|
||||||
echo "No commits between ${TARGET_BRANCH} and ${SOURCE_BRANCH}. Skipping pull request creation."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
payload="$(
|
|
||||||
jq -n \
|
|
||||||
--arg base "$TARGET_BRANCH" \
|
|
||||||
--arg head "$SOURCE_BRANCH" \
|
|
||||||
--arg title 'chore: Merge branch `dev` to `main`' \
|
|
||||||
--arg body 'When dev (pre-release) is ready, merge this pull request to create a new stable release.' \
|
|
||||||
'{base: $base, head: $head, title: $title, body: $body}'
|
|
||||||
)"
|
|
||||||
|
|
||||||
curl --fail-with-body --silent --show-error \
|
|
||||||
--request POST \
|
|
||||||
--header "$auth_header" \
|
|
||||||
--header "Content-Type: application/json" \
|
|
||||||
--data "$payload" \
|
|
||||||
"${api_url}/repos/${GITEA_REPOSITORY}/pulls" >/dev/null
|
|
||||||
echo "Pull request created."
|
|
||||||
@@ -52,6 +52,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
GITEA_URL: ${{ gitea.server_url }}
|
GITEA_URL: ${{ gitea.server_url }}
|
||||||
|
GITEA_PUBLIC_URL: https://git.krtss.de
|
||||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||||
GITEA_REF_NAME: ${{ gitea.ref_name }}
|
GITEA_REF_NAME: ${{ gitea.ref_name }}
|
||||||
run: npx semantic-release
|
run: npx semantic-release
|
||||||
|
|||||||
+2
-20
@@ -1,11 +1,5 @@
|
|||||||
{
|
{
|
||||||
"branches": [
|
"branches": ["main"],
|
||||||
"main",
|
|
||||||
{
|
|
||||||
"name": "dev",
|
|
||||||
"prerelease": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"plugins": [
|
"plugins": [
|
||||||
[
|
[
|
||||||
"@semantic-release/commit-analyzer",
|
"@semantic-release/commit-analyzer",
|
||||||
@@ -46,7 +40,7 @@
|
|||||||
[
|
[
|
||||||
"@semantic-release/exec",
|
"@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"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -61,18 +55,6 @@
|
|||||||
],
|
],
|
||||||
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
[
|
|
||||||
"@cleyrop-org/semantic-release-backmerge",
|
|
||||||
{
|
|
||||||
"backmergeBranches": [
|
|
||||||
{
|
|
||||||
"from": "main",
|
|
||||||
"to": "dev"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"clearWorkspace": true
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
## [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
|
||||||
|
|
||||||
|
* update release strat ([818e291](http://gitea:3000/StanPonomarev/twitter-patch/commit/818e291ffdfa17eff5f57e9a47e3f73a00b7c050))
|
||||||
|
|
||||||
## 1.0.0 (2026-08-21)
|
## 1.0.0 (2026-08-21)
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Patch bundle for X (Twitter), maintained by
|
|||||||
[Stan Ponomarev](https://git.krtss.de/StanPonomarev).
|
[Stan Ponomarev](https://git.krtss.de/StanPonomarev).
|
||||||
|
|
||||||
<!-- PATCHES_START -->
|
<!-- PATCHES_START -->
|
||||||
> **[v1.0.0](http://gitea:3000/StanPonomarev/twitter-patch/releases/tag/v1.0.0)** • `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>
|
<details open>
|
||||||
<summary>📦 X • 1 patch</summary>
|
<summary>📦 X • 1 patch</summary>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 1.0.0
|
version = 1.0.2
|
||||||
|
|||||||
Generated
-28
@@ -5,7 +5,6 @@
|
|||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cleyrop-org/semantic-release-backmerge": "^6.2.0",
|
|
||||||
"@semantic-release/exec": "^7.1.0",
|
"@semantic-release/exec": "^7.1.0",
|
||||||
"@semantic-release/git": "^11.0.1",
|
"@semantic-release/git": "^11.0.1",
|
||||||
"conventional-changelog-conventionalcommits": "^9.3.1",
|
"conventional-changelog-conventionalcommits": "^9.3.1",
|
||||||
@@ -87,26 +86,6 @@
|
|||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@cleyrop-org/semantic-release-backmerge": {
|
|
||||||
"version": "6.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@cleyrop-org/semantic-release-backmerge/-/semantic-release-backmerge-6.2.0.tgz",
|
|
||||||
"integrity": "sha512-d3dvZJgwBqsbhWKW1msIWlnkv3c1UoxUkFznrIYb0IewIiJLrfSv6ZWQvJVG67opAc3yTcqiovVL/J8G7/UnAA==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@semantic-release/error": "^4.0.0",
|
|
||||||
"aggregate-error": "^5.0.0",
|
|
||||||
"debug": "^4.4.3",
|
|
||||||
"execa": "^9.6.1",
|
|
||||||
"lodash": "^4.18.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "^22.14.0 || >=24.10.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"semantic-release": ">=24"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@colors/colors": {
|
"node_modules/@colors/colors": {
|
||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
|
||||||
@@ -2201,13 +2180,6 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lodash": {
|
|
||||||
"version": "4.18.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
|
|
||||||
"integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/lodash-es": {
|
"node_modules/lodash-es": {
|
||||||
"version": "4.18.1",
|
"version": "4.18.1",
|
||||||
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz",
|
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cleyrop-org/semantic-release-backmerge": "^6.2.0",
|
|
||||||
"@semantic-release/exec": "^7.1.0",
|
"@semantic-release/exec": "^7.1.0",
|
||||||
"@semantic-release/git": "^11.0.1",
|
"@semantic-release/git": "^11.0.1",
|
||||||
"conventional-changelog-conventionalcommits": "^9.3.1",
|
"conventional-changelog-conventionalcommits": "^9.3.1",
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"created_at": "2026-08-21T14:54:51",
|
"created_at": "2026-08-21T15:48:15",
|
||||||
"description": "## 1.0.0 (2026-08-21)\n\n### 🐛 Bug Fixes\n\n* fix release ([9a26817](http://gitea:3000/StanPonomarev/twitter-patch/commit/9a26817b4133e2d0c3bde7ee86ef0f5eb4b72fd9))\n* readme template ([59b41b5](http://gitea:3000/StanPonomarev/twitter-patch/commit/59b41b55603351bffccc046d06147ffbe14b62e7))\n\n### ✨ New Features\n\n* disable outdated version screen ([c5d43f5](http://gitea:3000/StanPonomarev/twitter-patch/commit/c5d43f5b51126ca0008653aada6d5c67bd793bd7))",
|
"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": "http://gitea:3000/StanPonomarev/twitter-patch/releases/download/v1.0.0/patches-1.0.0.mpp",
|
"download_url": "https://git.krtss.de/StanPonomarev/twitter-patch/releases/download/v1.0.2/patches-1.0.2.mpp",
|
||||||
"signature_download_url": "",
|
"signature_download_url": "",
|
||||||
"version": "1.0.0"
|
"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.",
|
"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.0",
|
"version": "1.0.2",
|
||||||
"patches": [
|
"patches": [
|
||||||
{
|
{
|
||||||
"name": "Disable outdated version screen",
|
"name": "Disable outdated version screen",
|
||||||
|
|||||||
Reference in New Issue
Block a user