10 Commits

Author SHA1 Message Date
Akkuman
4875285c09 fix: author info 2025-11-07 16:09:48 +08:00
Akkuman
aae35ac409 Merge remote-tracking branch 'origin/main' into pr-branch 2025-11-07 16:04:59 +08:00
akkuman
c95a2785f0 Merge pull request #8 from grypho/main
Feature: Preserve UI fields when creating/uploading a release
2025-11-07 16:56:49 +09:00
Dominik Wetzel
424dc33baa fix: Keep existing values by default when updating release 2025-11-07 08:22:00 +01:00
Carsten Schumann
9ca8dcac95 Bugfix: body_path was ignored because of default body. 2025-10-20 11:59:36 +02:00
Carsten Schumann
05b1004877 Update README 2025-10-20 11:25:28 +02:00
Carsten Schumann
008a54b0cd Feature: When using the Gitea UI to create an release the fields "name", "body" and "prerelease" are no longer overwritten with empty values. The existing data is used by default. 2025-08-20 10:41:54 +02:00
akkuman
fe8e032280 Merge pull request #7 from n08i40k/main
Declare missing body_path input in action.yml
2025-07-28 09:19:09 +08:00
Nikita
3dbdc45d61 docs: declare body_path input 2025-07-26 14:35:12 +04:00
Akkuman
f66c1c98f1 fix: deletion of old releases
Duplicate deletions occur when users generate their own .md5 and .sha256 files and do not use action's built-in md5sum and sha256sum functions.
issue: https://github.com/akkuman/gitea-release-action/issues/5
2025-06-25 10:53:06 +08:00
4 changed files with 46 additions and 24 deletions

View File

@@ -2,6 +2,8 @@
An action to support publishing release to Gitea. An action to support publishing release to Gitea.
Preserves the fields body, prerelease and name when pushing the release if no value is given.
## Inputs ## Inputs
The following are optional as `step.with` keys The following are optional as `step.with` keys

View File

@@ -10,10 +10,14 @@ inputs:
body: body:
description: "Note-worthy description of changes in release" description: "Note-worthy description of changes in release"
required: false required: false
default: ${{ github.event.release.body != '' && github.event.release.body || null }}
body_path:
description: "Path to load description of changes in this release"
required: false
name: name:
description: "Gives the release a custom name. Defaults to tag name" description: "Gives the release a custom name. Defaults to tag name"
required: false required: false
default: ${{ github.ref_name }} default: ${{ github.event.release.name != '' && github.event.release.name || github.ref_name }}
tag_name: tag_name:
description: "Gives a tag name. Defaults to github.GITHUB_REF" description: "Gives a tag name. Defaults to github.GITHUB_REF"
required: false required: false
@@ -21,9 +25,11 @@ inputs:
draft: draft:
description: "Creates a draft release. Defaults to false" description: "Creates a draft release. Defaults to false"
required: false required: false
default: ${{ github.event.release.draft || false }}
prerelease: prerelease:
description: "Identify the release as a prerelease. Defaults to false" description: "Identify the release as a prerelease. Defaults to false"
required: false required: false
default: ${{ github.event.release.prerelease || false }}
files: files:
description: "Newline-delimited list of path globs for asset files to upload" description: "Newline-delimited list of path globs for asset files to upload"
required: false required: false

13
dist/index.js vendored
View File

@@ -48279,10 +48279,18 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) {
id: release_id, id: release_id,
}) })
// deleted old release attachment // deleted old release attachment
const will_deleted = new Set();
for (const filepath of all_files) { for (const filepath of all_files) {
will_deleted.add(external_path_.basename(filepath));
if (params.md5sum) {
will_deleted.add(`${external_path_.basename(filepath)}.md5`);
}
if (params.sha256sum) {
will_deleted.add(`${external_path_.basename(filepath)}.sha256`);
}
}
for (const attachment of attachments) { for (const attachment of attachments) {
let will_deleted = [external_path_.basename(filepath), `${external_path_.basename(filepath)}.md5`, `${external_path_.basename(filepath)}.sha256`] if (will_deleted.has(attachment.name)) {
if (will_deleted.includes(attachment.name)) {
await client.repository.repoDeleteReleaseAttachment({ await client.repository.repoDeleteReleaseAttachment({
owner: owner, owner: owner,
repo: repo, repo: repo,
@@ -48292,7 +48300,6 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) {
console.log(`Successfully deleted old release attachment ${attachment.name}`) console.log(`Successfully deleted old release attachment ${attachment.name}`)
} }
} }
}
// upload new release attachment // upload new release attachment
for (const filepath of all_files) { for (const filepath of all_files) {
const content = external_fs_.readFileSync(filepath); const content = external_fs_.readFileSync(filepath);

13
main.js
View File

@@ -143,10 +143,18 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) {
id: release_id, id: release_id,
}) })
// deleted old release attachment // deleted old release attachment
const will_deleted = new Set();
for (const filepath of all_files) { for (const filepath of all_files) {
will_deleted.add(path.basename(filepath));
if (params.md5sum) {
will_deleted.add(`${path.basename(filepath)}.md5`);
}
if (params.sha256sum) {
will_deleted.add(`${path.basename(filepath)}.sha256`);
}
}
for (const attachment of attachments) { for (const attachment of attachments) {
let will_deleted = [path.basename(filepath), `${path.basename(filepath)}.md5`, `${path.basename(filepath)}.sha256`] if (will_deleted.has(attachment.name)) {
if (will_deleted.includes(attachment.name)) {
await client.repository.repoDeleteReleaseAttachment({ await client.repository.repoDeleteReleaseAttachment({
owner: owner, owner: owner,
repo: repo, repo: repo,
@@ -156,7 +164,6 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) {
console.log(`Successfully deleted old release attachment ${attachment.name}`) console.log(`Successfully deleted old release attachment ${attachment.name}`)
} }
} }
}
// upload new release attachment // upload new release attachment
for (const filepath of all_files) { for (const filepath of all_files) {
const content = fs.readFileSync(filepath); const content = fs.readFileSync(filepath);