Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
alyx | 7506090dd6 | ||
alyx | 988ba8ec1c | ||
meli-release-bot | 4107cb309d | ||
Geoffroy Empain | 1b91ee6c31 | ||
Geoffroy Empain | c616d2eb46 | ||
Geoffroy Empain | 0a12abda26 | ||
Geoffroy Empain | 091debe745 | ||
Geoffroy Empain | d1da01e743 | ||
semantic-release | 543f2ef0d3 | ||
semantic-release-bot | 1ea8332579 | ||
Geoffroy Empain | 2b3ea929c4 | ||
semantic-release | 71b346bcc4 | ||
semantic-release-bot | 9ee6c78b70 | ||
Geoffroy Empain | 3d21eea234 | ||
semantic-release | 8365015a2e | ||
Geoffroy Empain | 2e4b2ea4bb | ||
Geoffroy Empain | 0c3e85cbe1 | ||
Geoffroy Empain | 3ea2f6c0f8 | ||
Geoffroy Empain | 9c1193dcf4 |
|
@ -0,0 +1,11 @@
|
|||
<!--
|
||||
|
||||
Thanks for opening a PR on this repo 🎉 ! This is just a quick reminder of things we'd like you to check before submitting:
|
||||
- [ ] target your PR to branch `next`
|
||||
- [ ] if necessary, updates the [docs](https://github.com/getmeli/meli-docs)
|
||||
- [ ] use [semantic commits](https://www.conventionalcommits.org/en/v1.0.0)
|
||||
- [ ] read our [contributing guidelines](https://github.com/getmeli/meli/blob/beta/CONTRIBUTING.md)
|
||||
|
||||
Thanks a lot, and happy coding 🚀
|
||||
|
||||
-->
|
|
@ -1,8 +1,10 @@
|
|||
name: main
|
||||
on: [ push ]
|
||||
on: [ push, pull_request ]
|
||||
env:
|
||||
GITHUB_REPOSITORY_SSH_URL: "git@github.com:${{ github.repository }}.git"
|
||||
IS_RELEASE_BRANCH: "${{ github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/beta' }}"
|
||||
GIT_AUTHOR_NAME: "meli-release-bot"
|
||||
GIT_COMMITTER_NAME: "meli-release-bot"
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -22,7 +24,7 @@ jobs:
|
|||
echo "Next release version is $(cat VERSION)"
|
||||
env:
|
||||
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
- name: "Lint"
|
||||
run: npm run lint
|
||||
|
@ -43,7 +45,7 @@ jobs:
|
|||
npx semantic-release -r $GITHUB_REPOSITORY_SSH_URL
|
||||
env:
|
||||
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
- name: "realign next"
|
||||
if: ${{ env.IS_RELEASE_BRANCH == 'true' }}
|
||||
|
|
27
CHANGELOG.md
27
CHANGELOG.md
|
@ -1,3 +1,30 @@
|
|||
# [1.2.0](https://github.com/getmeli/meli-cli/compare/v1.1.2...v1.2.0) (2021-02-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* wrong logger namespace ([c616d2e](https://github.com/getmeli/meli-cli/commit/c616d2eb4661188b4d7926e7f96bb9937bdd5814))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* only warn repo undetected inside non-tty ([1b91ee6](https://github.com/getmeli/meli-cli/commit/1b91ee6c3176adf87c1dde6d875b42703e2a0d09))
|
||||
* update axios ([091debe](https://github.com/getmeli/meli-cli/commit/091debe74562c0a2b869098a37d84d8c3220a563))
|
||||
|
||||
## [1.1.2](https://github.com/getmeli/meli-cli/compare/v1.1.1...v1.1.2) (2020-12-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cannot upload large sites ([2b3ea92](https://github.com/getmeli/meli-cli/commit/2b3ea929c4b0f315f058ed9885669aecbc7b22bf))
|
||||
|
||||
## [1.1.1](https://github.com/getmeli/meli-cli/compare/v1.1.0...v1.1.1) (2020-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* tar not working for branches with slashes ([3d21eea](https://github.com/getmeli/meli-cli/commit/3d21eea2347cc382b46ddc08de29b19ec6e88231))
|
||||
|
||||
# [1.1.0](https://github.com/getmeli/meli-cli/compare/v1.0.0...v1.1.0) (2020-12-09)
|
||||
|
||||
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020 Meli
|
||||
Copyright (c) 2021 Meli
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
</p>
|
||||
<h1 align="center">meli-cli</h1>
|
||||
<p align="center">Open source platform for deploying static sites and frontend applications.</p>
|
||||
<p align="center">
|
||||
<a href="https://discord.gg/TFTaCUEdX6" target="_blank">
|
||||
<img alt="Discord" src="https://img.shields.io/discord/789462736320856075?label=community">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
> Found a security issue ? Please [let us know !](https://github.com/gomeli/meli-cli/security/advisories/new)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@getmeli/cli",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1514,6 +1514,12 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/uuid": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.0.tgz",
|
||||
"integrity": "sha512-eQ9qFW/fhfGJF8WKHGEHZEyVWfZxrT+6CLIJGBcZPfxUh/+BnEj+UCGYMlr9qZuX/2AltsvwrGqp0LhEW8D0zQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/yargs": {
|
||||
"version": "15.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.9.tgz",
|
||||
|
@ -2200,9 +2206,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.21.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz",
|
||||
"integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==",
|
||||
"version": "0.21.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.10.0"
|
||||
}
|
||||
|
@ -5019,9 +5025,9 @@
|
|||
"integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw=="
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
|
||||
"integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA=="
|
||||
"version": "1.13.1",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
|
||||
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg=="
|
||||
},
|
||||
"for-in": {
|
||||
"version": "1.0.2",
|
||||
|
@ -13002,9 +13008,9 @@
|
|||
}
|
||||
},
|
||||
"semantic-release-license": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/semantic-release-license/-/semantic-release-license-1.0.0.tgz",
|
||||
"integrity": "sha512-aRnLnTjsrP67kmKVF0h7lEQi9n3yGXADcuL3iyPajF8gHbzPrYu9iBT9WfzG6pIIqOtx1Clfnx/GSc6CdT/Ypw==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/semantic-release-license/-/semantic-release-license-1.0.2.tgz",
|
||||
"integrity": "sha512-qZJfGD7L3IDdMDaYJBaxgllnHQxOya+WMMdYIWnOx7ZP2MB4O2N/TXJjmLq7UXmvDSDhcJnUS2Pv1jfDzHwBqA==",
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
|
@ -13323,6 +13329,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"slugify": {
|
||||
"version": "1.4.6",
|
||||
"resolved": "https://registry.npmjs.org/slugify/-/slugify-1.4.6.tgz",
|
||||
"integrity": "sha512-ZdJIgv9gdrYwhXqxsH9pv7nXxjUEyQ6nqhngRxoAAOlmMGA28FDq5O4/5US4G2/Nod7d1ovNcgURQJ7kHq50KQ=="
|
||||
},
|
||||
"snapdragon": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
|
||||
|
@ -14582,11 +14593,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.3.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz",
|
||||
"integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.2.0",
|
||||
|
|
13
package.json
13
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@getmeli/cli",
|
||||
"version": "1.1.0",
|
||||
"name": "@whatthegit/meli-cli",
|
||||
"version": "1.2.0",
|
||||
"description": "Meli CLI",
|
||||
"main": "build/index.js",
|
||||
"bin": {
|
||||
|
@ -22,14 +22,16 @@
|
|||
"lint:fix": "eslint ./src --ext .js,.jsx,.ts,.tsx --fix"
|
||||
},
|
||||
"author": "Charlie Bravo SRL",
|
||||
"license": "UNLICENSED",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.0",
|
||||
"axios": "^0.21.1",
|
||||
"chalk": "^4.1.0",
|
||||
"debug": "^4.2.0",
|
||||
"form-data": "^3.0.0",
|
||||
"slugify": "^1.4.6",
|
||||
"source-map-support": "^0.5.19",
|
||||
"tar": "^6.0.5",
|
||||
"uuid": "^8.3.2",
|
||||
"winston": "^3.3.3",
|
||||
"yargs": "^15.4.1"
|
||||
},
|
||||
|
@ -41,6 +43,7 @@
|
|||
"@types/jest": "^25.2.3",
|
||||
"@types/node": "^12.19.4",
|
||||
"@types/tar": "^4.0.3",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^3.9.0",
|
||||
"@typescript-eslint/parser": "^3.9.0",
|
||||
"eslint": "^7.7.0",
|
||||
|
@ -50,7 +53,7 @@
|
|||
"eslint-plugin-security": "^1.4.0",
|
||||
"jest": "^26.6.3",
|
||||
"semantic-release": "^17.3.0",
|
||||
"semantic-release-license": "^1.0.0",
|
||||
"semantic-release-license": "^1.0.2",
|
||||
"terser-webpack-plugin": "^2.3.8",
|
||||
"ts-jest": "^25.5.1",
|
||||
"ts-loader": "^6.2.2",
|
||||
|
|
|
@ -6,53 +6,25 @@ import { Gitlab } from './gitlab';
|
|||
import { Gitea } from './gitea';
|
||||
import { UploadResponse } from '../upload-response';
|
||||
|
||||
const logger = new Logger('meli.server:setCommitStatus');
|
||||
const logger = new Logger('meli.cli:setCommitStatus');
|
||||
|
||||
export async function setCommitStatus(data: UploadResponse, release?: string): Promise<void> {
|
||||
const commitHash = getCommitHash();
|
||||
const repoId = getRepoId();
|
||||
|
||||
if (!repoId) {
|
||||
logger.warn('Repo id not detected, cannot set commit status');
|
||||
logger[process.stdout.isTTY ? 'debug' : 'warn']('Repo id not detected, cannot set commit status');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!commitHash) {
|
||||
logger.warn('Commit hash not detected, cannot set commit status');
|
||||
logger[process.stdout.isTTY ? 'debug' : 'warn']('Commit hash not detected, cannot set commit status');
|
||||
return;
|
||||
}
|
||||
|
||||
const context = 'meli';
|
||||
const description = release ? `Release ${release} deployed to Meli` : 'Site deployed to Meli';
|
||||
|
||||
if (process.env.GITHUB_TOKEN) {
|
||||
logger.info('Setting Github commit status');
|
||||
|
||||
const github = new Github(process.env.GITHUB_TOKEN, process.env.GITHUB_SERVER_URL);
|
||||
await github.setCommitStatus(repoId, commitHash, {
|
||||
context,
|
||||
description,
|
||||
status: data ? 'success' : 'failure',
|
||||
url: data?.urls[0],
|
||||
});
|
||||
} else {
|
||||
logger.debug('Github token not found, will not set commit status');
|
||||
}
|
||||
|
||||
if (process.env.GITLAB_TOKEN) {
|
||||
logger.info('Setting Gitlab commit status');
|
||||
|
||||
const gitlab = new Gitlab(process.env.GITLAB_TOKEN, process.env.GITLAB_URL);
|
||||
await gitlab.setCommitStatus(repoId, commitHash, {
|
||||
name: context,
|
||||
description,
|
||||
state: data ? 'success' : 'failed',
|
||||
url: data?.urls[0],
|
||||
});
|
||||
} else {
|
||||
logger.debug('Gitlab token not found, will not set commit status');
|
||||
}
|
||||
|
||||
if (process.env.GITEA_TOKEN && process.env.GITEA_URL) {
|
||||
logger.info('Setting Gitea commit status');
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import slug from 'slugify';
|
||||
|
||||
export function slugify(str: string): string {
|
||||
return slug(str, {
|
||||
replacement: '-',
|
||||
lower: true,
|
||||
});
|
||||
}
|
|
@ -4,11 +4,12 @@ import { Logger } from '../../commons/logger/logger';
|
|||
import { UploadOptions } from './upload-options';
|
||||
import { uploadArchive } from './upload-archive';
|
||||
import { archiveFiles } from './archive-files';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
const logger = new Logger('meli.cli:upload');
|
||||
|
||||
export async function upload(options: UploadOptions): Promise<void> {
|
||||
const archivePath = join(tmpdir(), `${options.site}-${options.release ?? 'latest'}-${options.branch}.tar.gz`);
|
||||
const archivePath = join(tmpdir(), `site-${uuid()}.tar.gz`);
|
||||
|
||||
logger.info(`Compressing files from ${options.directory}....`);
|
||||
await archiveFiles(options.directory, archivePath);
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import axiosModule from 'axios';
|
||||
import { ensureStackTrace } from './ensure-stack-trace';
|
||||
|
||||
export const axios = axiosModule.create();
|
||||
export const axios = axiosModule.create({
|
||||
maxBodyLength: Infinity,
|
||||
maxContentLength: Infinity,
|
||||
});
|
||||
|
||||
ensureStackTrace(axios);
|
||||
|
|
Loading…
Reference in New Issue