mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
GitHub Actions Release script; (#5384)
* chore(ci): Add release-it script; * chore(ci): add github actions release script;
This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
name: Release Axios
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
type:
|
||||||
|
type: choice
|
||||||
|
description: Choose release type
|
||||||
|
options:
|
||||||
|
- auto
|
||||||
|
- patch
|
||||||
|
- minor
|
||||||
|
- major
|
||||||
|
default: auto
|
||||||
|
beta:
|
||||||
|
type: boolean
|
||||||
|
description: Prerelease
|
||||||
|
default: false
|
||||||
|
npm:
|
||||||
|
type: boolean
|
||||||
|
description: NPM release
|
||||||
|
default: true
|
||||||
|
dry:
|
||||||
|
type: boolean
|
||||||
|
description: Dry release
|
||||||
|
default: false
|
||||||
|
jobs:
|
||||||
|
releaseIt:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: git config
|
||||||
|
run: |
|
||||||
|
git config user.name "${GITHUB_ACTOR}"
|
||||||
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
cache: npm
|
||||||
|
- name: npm credentials
|
||||||
|
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
|
||||||
|
- run: npm install
|
||||||
|
- name: release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TYPE_ARG: ${{ fromJSON('{"auto":"", "patch":"--patch", "minor":"--minor", "major":"--major"}')[github.event.inputs.type] }}
|
||||||
|
BETA_ARG: ${{ github.event.inputs.beta == true && '--preRelease=beta' || '' }}
|
||||||
|
NPM_ARG: ${{ github.event.inputs.npm == false && '--no-npm' || '' }}
|
||||||
|
DRY_ARG: ${{ github.event.inputs.dry == true && '--dry-run' || '' }}
|
||||||
|
run: npm run release -- --ci --verbose $NPM_ARG $TYPE_ARG $BETA_ARG $DRY_ARG
|
||||||
@@ -2,9 +2,8 @@ import fs from 'fs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import axios from '../index.js';
|
import axios from '../index.js';
|
||||||
import axiosBuild from '../dist/node/axios.cjs';
|
import axiosBuild from '../dist/node/axios.cjs';
|
||||||
import inquirer from 'inquirer';
|
|
||||||
|
|
||||||
const {version, name} = JSON.parse(fs.readFileSync('./package.json'));
|
const {version} = JSON.parse(fs.readFileSync('./package.json'));
|
||||||
|
|
||||||
console.log('Checking versions...\n----------------------------')
|
console.log('Checking versions...\n----------------------------')
|
||||||
|
|
||||||
@@ -16,27 +15,6 @@ console.log(`----------------------------`);
|
|||||||
assert.strictEqual(version, axios.VERSION, `Version mismatch between package and Axios`);
|
assert.strictEqual(version, axios.VERSION, `Version mismatch between package and Axios`);
|
||||||
assert.strictEqual(version, axiosBuild.VERSION, `Version mismatch between package and build`);
|
assert.strictEqual(version, axiosBuild.VERSION, `Version mismatch between package and build`);
|
||||||
|
|
||||||
console.log('PASSED\n');
|
console.log('✔️ PASSED\n');
|
||||||
|
|
||||||
const choices = [
|
|
||||||
`Yes, let's release Axios v${version} to npm`,
|
|
||||||
`No, don't do an npm release - I'll do it myself`
|
|
||||||
];
|
|
||||||
|
|
||||||
inquirer
|
|
||||||
.prompt([
|
|
||||||
{
|
|
||||||
type: 'list',
|
|
||||||
name: 'release',
|
|
||||||
message: `You have requested an npm release for ${name.toUpperCase()} v${version}. Are you sure?`,
|
|
||||||
choices
|
|
||||||
}
|
|
||||||
])
|
|
||||||
.then((answers) => {
|
|
||||||
if (choices.indexOf(answers.release)) {
|
|
||||||
console.warn('terminate...');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -91,7 +91,6 @@
|
|||||||
"get-stream": "^3.0.0",
|
"get-stream": "^3.0.0",
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^4.0.2",
|
||||||
"husky": "^8.0.2",
|
"husky": "^8.0.2",
|
||||||
"inquirer": "^9.1.4",
|
|
||||||
"istanbul-instrumenter-loader": "^3.0.1",
|
"istanbul-instrumenter-loader": "^3.0.1",
|
||||||
"jasmine-core": "^2.4.1",
|
"jasmine-core": "^2.4.1",
|
||||||
"karma": "^6.3.17",
|
"karma": "^6.3.17",
|
||||||
@@ -169,7 +168,7 @@
|
|||||||
},
|
},
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"before:init": "npm test",
|
"before:init": "npm test",
|
||||||
"after:bump": "gulp version && npm run build",
|
"after:bump": "gulp version && npm run build && npm run test:build:version",
|
||||||
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
|
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user