Skip to content

Commit

Permalink
Switch to TypeScript Action (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max authored Oct 10, 2019
1 parent 08d0501 commit 95b7f65
Show file tree
Hide file tree
Showing 17 changed files with 523 additions and 122 deletions.
6 changes: 0 additions & 6 deletions .dockerignore

This file was deleted.

2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/lib/** linguist-detectable=false
/node_modules/** linguist-detectable=false
44 changes: 0 additions & 44 deletions .github/workflows/docker.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: lint

on:
pull_request:
branches:
- master
- releases/*
paths:
- src/*

jobs:
lint:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v1
-
name: Setup TS
run: npm install tslint typescript -g
-
name: Lint check
run: tslint './src/*.ts'
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: release

on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'

jobs:
release:
runs-on: ubuntu-latest
steps:
-
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
-
name: NPM production deps
run: |
rm -rf node_modules
sed -i '/node_modules/d' .gitignore
npm install --production
-
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 }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
-
name: Deploy
if: success()
uses: crazy-max/ghaction-github-pages@master
uses: ./
with:
target_branch: test
build_dir: public
Expand Down
94 changes: 93 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,97 @@
/.dev

# Jetbrains
/.idea
/*.iml

/public
# Ignore node_modules on active branch
node_modules/

# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
22 changes: 0 additions & 22 deletions Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
Docker :whale: image is also provided and automatically updated within [Docker Hub](https://hub.docker.com/r/crazymax/ghaction-github-pages/tags) so you can directly use the following [Docker Hub action](https://help.github.com/en/articles/workflow-syntax-for-github-actions#example-using-a-docker-hub-action):
```yaml
- name: Deploy
if: success()
uses: docker://crazymax/ghaction-github-pages
env:
INPUT_TARGET_BRANCH: gh-pages
INPUT_BUILD_DIR: public
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
## 💅 Customizing
### inputs
Expand Down
8 changes: 3 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ inputs:
description: 'Git branch where assets will be deployed'
default: 'gh-pages'
build_dir:
description: 'Path to build directory to deploy'
description: 'Build directory to deploy'
required: true

runs:
using: 'docker'
image: 'Dockerfile'
env:
GITHUB_TOKEN: 'As provided by GitHub Actions'
using: 'node12'
main: 'lib/main.js'
31 changes: 0 additions & 31 deletions entrypoint.sh

This file was deleted.

Loading

0 comments on commit 95b7f65

Please sign in to comment.