mirror of
https://gitea.com/actions/gitea-release-action.git
synced 2025-11-28 12:28:54 +08:00
Compare commits
10 Commits
v1.3.3
...
4875285c09
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4875285c09 | ||
|
|
aae35ac409 | ||
|
|
c95a2785f0 | ||
|
|
424dc33baa | ||
|
|
9ca8dcac95 | ||
|
|
05b1004877 | ||
|
|
008a54b0cd | ||
|
|
fe8e032280 | ||
|
|
3dbdc45d61 | ||
|
|
f66c1c98f1 |
@@ -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
|
||||||
|
|||||||
10
action.yml
10
action.yml
@@ -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
|
||||||
@@ -49,4 +55,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
29
dist/index.js
vendored
@@ -48279,18 +48279,25 @@ 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) {
|
||||||
for (const attachment of attachments) {
|
will_deleted.add(external_path_.basename(filepath));
|
||||||
let will_deleted = [external_path_.basename(filepath), `${external_path_.basename(filepath)}.md5`, `${external_path_.basename(filepath)}.sha256`]
|
if (params.md5sum) {
|
||||||
if (will_deleted.includes(attachment.name)) {
|
will_deleted.add(`${external_path_.basename(filepath)}.md5`);
|
||||||
await client.repository.repoDeleteReleaseAttachment({
|
}
|
||||||
owner: owner,
|
if (params.sha256sum) {
|
||||||
repo: repo,
|
will_deleted.add(`${external_path_.basename(filepath)}.sha256`);
|
||||||
id: release_id,
|
}
|
||||||
attachmentId: attachment.id,
|
}
|
||||||
})
|
for (const attachment of attachments) {
|
||||||
console.log(`Successfully deleted old release attachment ${attachment.name}`)
|
if (will_deleted.has(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
29
main.js
@@ -143,18 +143,25 @@ 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) {
|
||||||
for (const attachment of attachments) {
|
will_deleted.add(path.basename(filepath));
|
||||||
let will_deleted = [path.basename(filepath), `${path.basename(filepath)}.md5`, `${path.basename(filepath)}.sha256`]
|
if (params.md5sum) {
|
||||||
if (will_deleted.includes(attachment.name)) {
|
will_deleted.add(`${path.basename(filepath)}.md5`);
|
||||||
await client.repository.repoDeleteReleaseAttachment({
|
}
|
||||||
owner: owner,
|
if (params.sha256sum) {
|
||||||
repo: repo,
|
will_deleted.add(`${path.basename(filepath)}.sha256`);
|
||||||
id: release_id,
|
}
|
||||||
attachmentId: attachment.id,
|
}
|
||||||
})
|
for (const attachment of attachments) {
|
||||||
console.log(`Successfully deleted old release attachment ${attachment.name}`)
|
if (will_deleted.has(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
|
||||||
|
|||||||
Reference in New Issue
Block a user