Rewrite in typescrypt #327

Merged
Sirherobrine23 merged 13 commits from re_Typescript into main 2022-03-28 21:43:14 +00:00
5 changed files with 291 additions and 0 deletions
Showing only changes of commit d0a16a00ec - Show all commits

View File

@ -0,0 +1,53 @@
name: Publish latest image
on:
push:
branches:
- main
paths:
- "docker-compose.yml"
- "package*.json"
- "Dockerfile"
- "README.md"
- "src/**/*"
- ".github/**/*"
env:
# DOCKERPLATFORM: "linux/amd64,linux/arm64"
DOCKERPLATFORM: "linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x"
DOCKERIMAGE: "ghcr.io/the-bds-maneger/core"
jobs:
latestDeploy:
runs-on: ubuntu-latest
name: Publish latest
environment:
name: PublishImage
url: "ghcr.io/ofvp-project/deamonmaneger"
steps:
- uses: actions/checkout@v2.4.0
with:
submodules: true
- name: Setup QEMU to Docker
uses: docker/setup-qemu-action@v1
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Login into registry Github Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push image
uses: docker/build-push-action@v2
with:
context: .
push: true
target: server
tags: ${{ env.DOCKERIMAGE }}:latest
platforms: ${{ env.DOCKERPLATFORM }}
cache-from: type=gha,scope=${{ github.ref }}_${{ hashFiles('**/package-lock.json') }}
cache-to: type=gha,mode=max,scope=${{ github.ref }}_${{ hashFiles('**/package-lock.json') }}

View File

@ -0,0 +1,46 @@
name: Publish release image
on:
release:
types:
- created
env:
# DOCKERPLATFORM: "linux/amd64,linux/arm64"
DOCKERPLATFORM: "linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x"
DOCKERIMAGE: "ghcr.io/the-bds-maneger/core"
jobs:
latestDeploy:
runs-on: ubuntu-latest
name: Publish latest
environment:
name: PublishImage
url: "ghcr.io/ofvp-project/deamonmaneger"
steps:
- uses: actions/checkout@v2.4.0
with:
submodules: true
- name: Setup QEMU to Docker
uses: docker/setup-qemu-action@v1
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Login into registry Github Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push image
uses: docker/build-push-action@v2
with:
context: .
push: true
target: server
tags: ${{ env.DOCKERIMAGE }}:latest
platforms: ${{ env.DOCKERPLATFORM }}
cache-from: type=gha,scope=${{ github.ref }}_${{ hashFiles('**/package-lock.json') }}
cache-to: type=gha,mode=max,scope=${{ github.ref }}_${{ hashFiles('**/package-lock.json') }}

73
.github/workflows/publish_npm_main.yml vendored Normal file
View File

@ -0,0 +1,73 @@
name: Publish dev/next module release
on:
push:
branches:
- main
paths:
- "docker-compose.yml"
- "package*.json"
- "Dockerfile"
- "README.md"
- "src/**/*"
- ".github/**/*"
env:
# DOCKERPLATFORM: "linux/amd64,linux/arm64"
DOCKERPLATFORM: "linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x"
DOCKERIMAGE: "ghcr.io/the-bds-maneger/core"
jobs:
latestDeploy:
runs-on: ubuntu-latest
name: Publish npm module
strategy:
matrix:
npm_registry:
- "Github"
- "NPM"
steps:
- uses: actions/checkout@v2.4.0
with:
submodules: true
- name: Setup Node.js (NPM Packages)
if: matrix.npm_registry == 'NPM'
uses: actions/setup-node@v3.0.0
with:
node-version: 16.x
registry-url: https://registry.npmjs.org/
- name: Setup Node.js (Github Packages)
if: matrix.npm_registry == 'Github'
uses: actions/setup-node@v3.0.0
with:
node-version: 16.x
registry-url: https://npm.pkg.github.com/
- name: Edit Version to next release
shell: node {0}
run: |
const fs = require("fs");
const JsonPackage = JSON.parse(fs.readFileSync(process.cwd()+"/package.json", "utf8"));
const run_ID = "${{ github.run_id }}";
JsonPackage.version = `${run_ID.slice(0, 2)}.${run_ID.slice(3, 6)}.${run_ID.slice(7, 11)}`;
fs.writeFileSync(process.cwd()+"/package.json", JSON.stringify(JsonPackage, null, 2));
console.log("New Version to Package:", JsonPackage.version);
- name: Install node depencies
run: npm install -d
- name: Build typescript to CJS and ESM
run: npm run build
- name: Publish Package
run: |
set -x
if [[ "${{ matrix.npm_registry }}" == "Github" ]];then
echo "Publish to Github Packages"
export NODE_AUTH_TOKEN="${{ secrets.GITHUB_TOKEN }}"
else
echo "Publish to NPM Registry"
export NODE_AUTH_TOKEN="${{ secrets.NPM_ORG_TOKEN }}"
fi
npm publish --tag next

View File

@ -0,0 +1,85 @@
name: Publish release module release
on:
release:
types:
- created
env:
# DOCKERPLATFORM: "linux/amd64,linux/arm64"
DOCKERPLATFORM: "linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x"
DOCKERIMAGE: "ghcr.io/the-bds-maneger/core"
jobs:
latestDeploy:
runs-on: ubuntu-latest
name: Publish npm module
strategy:
matrix:
npm_registry:
- "Github"
- "NPM"
steps:
- uses: actions/checkout@v2.4.0
with:
submodules: true
- name: Setup Node.js (NPM Packages)
if: matrix.npm_registry == 'NPM'
uses: actions/setup-node@v3.0.0
with:
node-version: 16.x
registry-url: https://registry.npmjs.org/
- name: Setup Node.js (Github Packages)
if: matrix.npm_registry == 'Github'
uses: actions/setup-node@v3.0.0
with:
node-version: 16.x
registry-url: https://npm.pkg.github.com/
- name: Remove Dev Version
shell: node {0}
run: |
const child_process = require("child_process");
const fs = require("fs");
const path = require("path");
const cli_color = require("cli-color");
(async function() {
global.fetch = (await import("node-fetch")).default;
fetch("https://registry.npmjs.org/@the-bds-maneger/core").then(res => res.json()).then(data => {
data.versions = Object.getOwnPropertyNames(data.versions).filter(version => /[0-9]+\.[0-9][0-9][0-9]/.test(version) && version !== data["dist-tags"].dev && version !== data["dist-tags"].latest)
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
const Package = require(process.cwd()+"/package.json");
data.versions.map(version => {
const cmd = `npm unpublish ${Package.name}@${version}`;
console.log(cli_color.yellow(cmd));
try {
child_process.execSync(cmd).toString()
console.log(cli_color.green(`Sucess to remove ${Package.name}@${version}`, "\n"));
return cmd;
} catch (e) {
console.log(cli_color.red(`Failed to remove package: ${Package.name}@${version}`), "\n");
return version;
}
});
fs.writeFileSync(path.resolve(__dirname, "Releases.json"), JSON.stringify(data, null, 2));
});
})();
- name: Install node depencies
run: npm install -d
- name: Build typescript to CJS and ESM
run: npm run build
- name: Publish Package
run: |
set -x
if [[ "${{ matrix.npm_registry }}" == "Github" ]];then
echo "Publish to Github Packages"
export NODE_AUTH_TOKEN="${{ secrets.GITHUB_TOKEN }}"
else
echo "Publish to NPM Registry"
export NODE_AUTH_TOKEN="${{ secrets.NPM_ORG_TOKEN }}"
fi
npm publish

34
.github/workflows/pull_request.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Publish dev/next module release
on:
pull_request:
env:
# DOCKERPLATFORM: "linux/amd64,linux/arm64"
DOCKERPLATFORM: "linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x"
DOCKERIMAGE: "ghcr.io/the-bds-maneger/core"
jobs:
latestDeploy:
runs-on: ubuntu-latest
name: Publish npm module
strategy:
matrix:
node_version:
- "15"
- "16"
- "17"
steps:
- uses: actions/checkout@v2.4.0
with:
submodules: true
- name: Setup Node.js (Github Packages)
uses: actions/setup-node@v3.0.0
with:
node-version: "${{ matrix.node_version }}.x"
- name: Install node depencies
run: npm install -d
- name: Build typescript to CJS and ESM
run: npm run build