Compare commits

..

No commits in common. "main" and "v1.3.3" have entirely different histories.
main ... v1.3.3

4 changed files with 24 additions and 46 deletions

View File

@ -2,8 +2,6 @@
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,14 +10,10 @@ 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.event.release.name != '' && github.event.release.name || github.ref_name }} default: ${{ 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
@ -25,11 +21,9 @@ 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
@ -55,4 +49,4 @@ runs:
main: "dist/index.js" main: "dist/index.js"
branding: branding:
color: "green" color: "green"
icon: "package" icon: "package"

29
dist/index.js vendored
View File

@ -48279,25 +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)); for (const attachment of attachments) {
if (params.md5sum) { let will_deleted = [external_path_.basename(filepath), `${external_path_.basename(filepath)}.md5`, `${external_path_.basename(filepath)}.sha256`]
will_deleted.add(`${external_path_.basename(filepath)}.md5`); if (will_deleted.includes(attachment.name)) {
} await client.repository.repoDeleteReleaseAttachment({
if (params.sha256sum) { owner: owner,
will_deleted.add(`${external_path_.basename(filepath)}.sha256`); repo: repo,
} id: release_id,
} attachmentId: attachment.id,
for (const attachment of attachments) { })
if (will_deleted.has(attachment.name)) { console.log(`Successfully deleted old release attachment ${attachment.name}`)
await client.repository.repoDeleteReleaseAttachment({ }
owner: owner,
repo: repo,
id: release_id,
attachmentId: attachment.id,
})
console.log(`Successfully deleted old release attachment ${attachment.name}`)
} }
} }
// upload new release attachment // upload new release attachment

29
main.js
View File

@ -143,25 +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)); for (const attachment of attachments) {
if (params.md5sum) { let will_deleted = [path.basename(filepath), `${path.basename(filepath)}.md5`, `${path.basename(filepath)}.sha256`]
will_deleted.add(`${path.basename(filepath)}.md5`); if (will_deleted.includes(attachment.name)) {
} await client.repository.repoDeleteReleaseAttachment({
if (params.sha256sum) { owner: owner,
will_deleted.add(`${path.basename(filepath)}.sha256`); repo: repo,
} id: release_id,
} attachmentId: attachment.id,
for (const attachment of attachments) { })
if (will_deleted.has(attachment.name)) { console.log(`Successfully deleted old release attachment ${attachment.name}`)
await client.repository.repoDeleteReleaseAttachment({ }
owner: owner,
repo: repo,
id: release_id,
attachmentId: attachment.id,
})
console.log(`Successfully deleted old release attachment ${attachment.name}`)
} }
} }
// upload new release attachment // upload new release attachment