Use ncc and clean workflows

This commit is contained in:
CrazyMax 2020-04-09 03:31:03 +02:00
parent 1f2ea644cc
commit 168bf72554
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
9 changed files with 27201 additions and 91 deletions

2
.gitattributes vendored
View File

@ -1,2 +1,2 @@
/dist/** linguist-generated=true
/lib/** linguist-generated=true
/node_modules/** linguist-detectable=false

View File

@ -14,10 +14,6 @@ jobs:
# https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v1
-
# https://github.com/actions/setup-node
name: Set up Node
uses: actions/setup-node@v1
-
name: Setup TS
run: npm install tslint typescript -g

View File

@ -1,72 +0,0 @@
name: release
on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
jobs:
release:
runs-on: ubuntu-latest
steps:
-
# https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v1
-
name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
MINOR=${TAG%.*}
MAJOR=${MINOR%.*}
echo ::set-output name=tag_name::${TAG}
echo ::set-output name=minor_tag::${MINOR}
echo ::set-output name=major_tag::${MAJOR}
echo ::set-output name=major_exists::$(git show-ref origin/releases/${MAJOR})
-
name: Set up Git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
-
name: Checkout releases/${{ steps.prepare.outputs.major_tag }} branch
run: |
git checkout -B releases/${{ steps.prepare.outputs.major_tag }}
if [ -n "${{ steps.prepare.outputs.major_exists }}" ]; then
git branch --set-upstream-to=origin/releases/${{ steps.prepare.outputs.major_tag }} releases/${{ steps.prepare.outputs.major_tag }}
fi
-
# https://github.com/actions/setup-node
name: Set up Node
uses: actions/setup-node@v1
-
name: NPM production deps
run: |
npm run build-dep
npm run prune
-
name: Commit and push changes
run: |
git add --all
git status --short -uno
git commit -m 'Release ${{ steps.prepare.outputs.tag_name }}'
git show --stat-count=10 HEAD
git push -f origin releases/${{ steps.prepare.outputs.major_tag }}
-
name: Update ${{ steps.prepare.outputs.minor_tag }} tag
run: |
git push origin :refs/tags/${{ steps.prepare.outputs.minor_tag }}
git tag -fa ${{ steps.prepare.outputs.minor_tag }} -m "Release ${{ steps.prepare.outputs.tag_name }}"
git push origin ${{ steps.prepare.outputs.minor_tag }}
-
name: Update ${{ steps.prepare.outputs.major_tag }} tag
run: |
git push origin :refs/tags/${{ steps.prepare.outputs.major_tag }}
git tag -fa ${{ steps.prepare.outputs.major_tag }} -m "Release ${{ steps.prepare.outputs.tag_name }}"
git push origin ${{ steps.prepare.outputs.major_tag }}

View File

@ -18,6 +18,11 @@ jobs:
# https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v1
-
name: Build
run: |
npm install
npm run build
-
name: Install
run: npm ci

6
.gitignore vendored
View File

@ -1,13 +1,11 @@
/.dev
/dist
node_modules/
lib
# Jetbrains
/.idea
/*.iml
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
!node_modules/
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs

View File

@ -20,4 +20,4 @@ inputs:
runs:
using: 'node12'
main: 'lib/main.js'
main: 'dist/index.js'

27177
dist/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

6
package-lock.json generated
View File

@ -1657,6 +1657,12 @@
"integrity": "sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==",
"dev": true
},
"@zeit/ncc": {
"version": "0.22.1",
"resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.22.1.tgz",
"integrity": "sha512-Qq3bMuonkcnV/96jhy9SQYdh39NXHxNMJ1O31ZFzWG9n52fR2DLtgrNzhj/ahlEjnBziMLGVWDbaS9sf03/fEw==",
"dev": true
},
"abab": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.1.tgz",

View File

@ -6,6 +6,13 @@
"directories": {
"lib": "lib"
},
"scripts": {
"build": "tsc && ncc build",
"test": "jest",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"pre-checkin": "npm run format && npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/goreleaser/goreleaser-action.git"
@ -28,6 +35,7 @@
"@types/download": "^6.2.4",
"@types/jest": "^25.2.1",
"@types/node": "^13.11.0",
"@zeit/ncc": "^0.22.1",
"jest": "^25.2.7",
"jest-circus": "^25.2.7",
"jest-runtime": "^25.2.7",
@ -35,13 +43,5 @@
"ts-jest": "^25.3.1",
"typescript": "^3.8.3",
"typescript-formatter": "^7.2.2"
},
"scripts": {
"build-dep": "npm install -g removeNPMAbsolutePaths",
"build": "tsc",
"test": "jest",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"prune": "npm prune --production && removeNPMAbsolutePaths \"./\" --force --fields _where _args"
}
}
}