This commit is contained in:
CrazyMax 2020-04-09 00:59:11 +02:00
parent 8d2db96d26
commit c3420389e2
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
12 changed files with 35 additions and 145 deletions

View File

@ -13,3 +13,6 @@ insert_final_newline = true
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[package.json]
insert_final_newline = false

2
.gitattributes vendored
View File

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

View File

@ -10,12 +10,9 @@ Contributions to this project are [released](https://help.github.com/articles/gi
2. Configure and install the dependencies: `npm install` 2. Configure and install the dependencies: `npm install`
4. Create a new branch: `git checkout -b my-branch-name` 4. Create a new branch: `git checkout -b my-branch-name`
5. Make your change 5. Make your change
6. Compile your Typescript code: `npm run build` 6. Run pre-checkin: `npm run pre-checkin`
7. Format your code: `npm run format` 7. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-github-pages/compare)
8. Install build dependencies: `npm run build-dep` 8. Pat your self on the back and wait for your pull request to be reviewed and merged.
9. Prune dependencies: `npm run prune`
10. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-github-pages/compare)
11. Pat your self on the back and wait for your pull request to be reviewed and merged.
Here are a few things you can do that will increase the likelihood of your pull request being accepted: Here are a few things you can do that will increase the likelihood of your pull request being accepted:

View File

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

View File

@ -3,11 +3,7 @@ name: master
on: on:
push: push:
branches: branches:
- 'master' - master
paths:
- 'node_modules/**'
- 'package.json'
- '.github/workflows/master.yml'
jobs: jobs:
prune: prune:
@ -22,14 +18,11 @@ jobs:
name: Fix detached HEAD name: Fix detached HEAD
run: git checkout ${GITHUB_REF#refs/heads/} run: git checkout ${GITHUB_REF#refs/heads/}
- -
# https://github.com/actions/setup-node name: Build
name: Set up Node
uses: actions/setup-node@v1
-
name: Prune prod
run: | run: |
npm run build-dep npm install
npm run prune npm run format
npm run build
- -
name: Set up Git name: Set up Git
env: env:
@ -43,6 +36,6 @@ jobs:
run: | run: |
git add . git add .
if output=$(git status --porcelain) && [ ! -z "$output" ]; then if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git commit -m 'Update node_modules' git commit -m 'Update generated content'
git push git push
fi fi

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

@ -14,6 +14,11 @@ jobs:
uses: actions/checkout@v1 uses: actions/checkout@v1
- -
name: Build name: Build
run: |
npm install
npm run build
-
name: Gen dummy page
run: | run: |
mkdir public mkdir public
cat > public/index.html <<EOL cat > public/index.html <<EOL

View File

@ -1,37 +0,0 @@
name: uncommited
on:
pull_request:
push:
jobs:
changes:
runs-on: ubuntu-latest
steps:
-
# 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: Build
run: |
npm install
npm run format
npm run build
-
name: Prune prod
run: |
npm run build-dep
npm run prune
-
name: Check for uncommitted changes
run: |
if [[ `git status --porcelain` ]]; then
git status --porcelain
echo "##[error] found changed files after build. please 'npm run build && npm run format && npm prune --production'"
exit 1
fi

5
.gitignore vendored
View File

@ -1,12 +1,11 @@
/.dev /.dev
node_modules/
lib
# Jetbrains # Jetbrains
/.idea /.idea
/*.iml /*.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 # Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs # Logs
logs logs

View File

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

6
package-lock.json generated
View File

@ -36,6 +36,12 @@
"integrity": "sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ==", "integrity": "sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ==",
"dev": true "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
},
"at-least-node": { "at-least-node": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",

View File

@ -5,6 +5,12 @@
"directories": { "directories": {
"lib": "lib" "lib": "lib"
}, },
"scripts": {
"build": "tsc && ncc build",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"pre-checkin": "npm run format && npm run build"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/crazy-max/ghaction-docker-buildx.git" "url": "git+https://github.com/crazy-max/ghaction-docker-buildx.git"
@ -26,15 +32,9 @@
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@types/fs-extra": "^8.1.0", "@types/fs-extra": "^8.1.0",
"@types/node": "^13.11.0", "@types/node": "^13.11.0",
"@zeit/ncc": "^0.22.1",
"prettier": "^2.0.4", "prettier": "^2.0.4",
"typescript": "^3.8.3", "typescript": "^3.8.3",
"typescript-formatter": "^7.2.2" "typescript-formatter": "^7.2.2"
},
"scripts": {
"build-dep": "npm install -g removeNPMAbsolutePaths",
"build": "tsc",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"prune": "npm prune --production && removeNPMAbsolutePaths \"./\" --force --fields _where _args"
} }
} }