init auto release project

This commit is contained in:
Adrien Beaudouin 2024-08-22 18:26:38 +02:00
parent a4beb00bf5
commit 9c918c1202
6 changed files with 147 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -14,6 +14,8 @@ inputs:
release:
description: "Auto incrementing release number according to semver"
default: "false"
gitea-token:
description: "Gitea token to create a release"
runs:
using: composite
@ -33,3 +35,7 @@ runs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- uses: gitea/actions/gitea-release@v1
if: ${{ inputs.release == 'true' }}
with:
token: ${{ inputs.gitea-token }}

16
release/action.yaml Normal file
View File

@ -0,0 +1,16 @@
name: Gitea Auto Release
description: Create Gitea release according to semver
inputs:
host:
description: "Server address of self-hosted Gitea."
default: ${{ vars.CONTAINER_REGISTRY }}
repository:
description: "Repository to make releases against, in <owner>/<repo> format"
default: ${{ gitea.repository }}
token:
description: "Gitea token to create a release"
runs:
using: node20
main: index.js

27
release/index.js Normal file
View File

@ -0,0 +1,27 @@
import core from "@actions/core";
import gitea from "gitea-api";
async function run() {
try {
const host = core.getInput("host");
const token = core.getInput("token");
const repository = core.getInput("repository");
const [owner, repo] = repository.split("/");
const gitea_client = new gitea.GiteaApi({
BASE: `https://${host}/api/v1`,
WITH_CREDENTIALS: true,
TOKEN: token,
});
console.log(`TEST ${host} ${token} ${repository} ${owner} ${repo}`);
// console.log(`🎉 Release ready at ${response.html_url}`);
} catch (error) {
console.log(error);
core.setFailed(error.message);
}
}
run();

82
release/package-lock.json generated Normal file
View File

@ -0,0 +1,82 @@
{
"name": "gitea-auto-release",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gitea-auto-release",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@actions/core": "^1.10.1",
"gitea-api": "^1.17.3-1"
}
},
"node_modules/@actions/core": {
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz",
"integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==",
"license": "MIT",
"dependencies": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"node_modules/@actions/http-client": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz",
"integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==",
"license": "MIT",
"dependencies": {
"tunnel": "^0.0.6",
"undici": "^5.25.4"
}
},
"node_modules/@fastify/busboy": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
"license": "MIT",
"engines": {
"node": ">=14"
}
},
"node_modules/gitea-api": {
"version": "1.17.3-1",
"resolved": "https://registry.npmjs.org/gitea-api/-/gitea-api-1.17.3-1.tgz",
"integrity": "sha512-Tj2s8feRRXfO4k6MmPyxa0JDDFG+VMifchc6gchzob+puFJErIIWkElQgum8JYT9sLsAFzHE/IFcMUx0ctlAhQ==",
"license": "Unlicense"
},
"node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"license": "MIT",
"engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
}
},
"node_modules/undici": {
"version": "5.28.4",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
"integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
"license": "MIT",
"dependencies": {
"@fastify/busboy": "^2.0.0"
},
"engines": {
"node": ">=14.0"
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"license": "MIT",
"bin": {
"uuid": "dist/bin/uuid"
}
}
}
}

15
release/package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "gitea-auto-release",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@actions/core": "^1.10.1",
"gitea-api": "^1.17.3-1"
}
}