Basic version with debug info

This commit is contained in:
Andreas Svanberg 2024-10-14 20:23:42 +02:00
commit 016a42758a
8 changed files with 33731 additions and 0 deletions

3
.gitignore vendored Normal file

@ -0,0 +1,3 @@
.idea/
lib/
node_modules/

8
action.yml Normal file

@ -0,0 +1,8 @@
name: 'Deploy to branch.dsv.su.se'
description: 'Deploy the current branch via Docker Compose to branch.dsv.su.se'
outputs:
url:
description: 'The URL of the deployed branch'
runs:
using: node20
main: dist/index.js

31887
dist/index.js vendored Normal file

File diff suppressed because one or more lines are too long

11
eslint.config.mjs Normal file

@ -0,0 +1,11 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{files: ["**/*.js"], languageOptions: {sourceType: "commonjs"}},
{languageOptions: {globals: globals.node}},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];

1750
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

33
package.json Normal file

@ -0,0 +1,33 @@
{
"name": "action-branch-deplay",
"version": "1.0.0",
"description": "Deploy a branch via Docker Compose to branch.dsv.su.se",
"author": {
"name": "Andreas Svanberg",
"email": "andreass@dsv.su.se"
},
"homepage": "https://gitea.dsv.su.se/ansv7779/action-branch-deploy",
"main": "dist/index.js",
"scripts": {
"build": "tsc && ncc build lib/main.js -o dist",
"lint": "eslint src/**/*.ts"
},
"repository": {
"type": "git",
"url": "git@gitea.dsv.su.se:ansv7779/action-branch-deploy.git"
},
"dependencies": {
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0"
},
"devDependencies": {
"@eslint/js": "^9.12.0",
"@types/node": "^20.14.8",
"@vercel/ncc": "^0.38.2",
"eslint": "^9.12.0",
"globals": "^15.11.0",
"typescript": "^5.6.3",
"typescript-eslint": "^8.8.1"
}
}

26
src/main.ts Normal file

@ -0,0 +1,26 @@
import core from '@actions/core';
import * as gitea from '@actions/github';
async function main() {
const branchName = gitea.context.ref;
const repositoryName = gitea.context.repo.repo;
core.info(`Branch name: ${branchName}`);
core.info(`Repository name: ${repositoryName}`);
core.setOutput('url', branchName);
//const token = core.getInput('gitea-token', {required: true});
const issueNumber = gitea.context.issue.number;
core.info(`Issue number: ${issueNumber}`);
core.info(`context.apiUrl: ${gitea.context.apiUrl}`);
}
main().catch(handleError);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function handleError(err: any): void {
console.error(err)
core.setFailed(`Unhandled error: ${err}`)
}

13
tsconfig.json Normal file

@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": ["es6"],
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"declaration": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}