Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ankri committed Sep 12, 2019
0 parents commit 4757695
Show file tree
Hide file tree
Showing 11 changed files with 5,425 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: release action

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: go to release branch
run: git checkout -B $(node -p -e "require('./package.json').version")
- name: merge with master
run: git merge origin/master --no-edit
- name: Authenticate with GitHub package registry to be able to download from private repositories
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
- name: npm install
run: npm install
- name: run build
run: npm run build
- name: add and push
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git add -A
git commit -m "released new version"
git push --force https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY $(node -p -e "require('./package.json').version")
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
__tests__/runner/*
.env
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@tangro:registry=https://npm.pkg.github.com/
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

The MIT License (MIT)

Copyright (c) 2018 GitHub, Inc. and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# tangro-actions-template

A GitHub Action template for tangro GitHub actions. It has the build step, the workflow and some dependencies pre-configured.

# Using this template

a) Either go to [the repository](https://github.com/tangro/tangro-actions-template) and click on [Use this template](https://github.com/tangro/tangro-actions-template/generate)
b) Or go to [create new tangro repo](https://github.com/organizations/tangro/repositories/new) or [create new user repo](https://github.com/new) and then select the `tangro/tangro-action-template` from the _Repository templaet_ list.

# Development

Create a new repository and copy the contents of this template repository to the new repository. Do not forget the `.github` folder it may be hidden on your machine.

# Publishing an action

> **Important** Do **not** run `npm build`. It will be done automatically. And do not check in the `dist` directory.
There is a workflow already pre-configured that automatically publishs a new version when you push your code to the `master` branch. The workflow will take your npm package version and publish the action under that version. You have two options

- Keep the current version number and the action will be updated
- Bump the version number and a new action will be created

The action-release workflow will create a branch with the `package.json` version as its name. An already existing branch will be overwritten.

After the workflow/action has run your action will be available to be used.

# FAQ

## Do I need to check-in the node_modules folder

No. This template uses [@zeit/ncc](https://github.com/zeit/ncc) to automatically create and bundle a single `index.js` with the `node_modules` and code included.

## Can I put the `dist/` folder into the `.gitignore`

No. It needs to be present for the action. It is planned to automatically alter the `.gitignore` to always check-in the `dist/` folder. But that's not ready yet.

## What happens if I ran `npm build`

Just delete the `dist/` folder.

## Can I use a different branch than `master`

Yes. Edit the `.github/workflows/release-action.yml`
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'Tangro Actions template'
description: 'Add a description'
author: 'tangro'
inputs:
example-input:
description: 'Add more inputs here'
required: true
runs:
using: 'node12'
main: 'dist/index.js'
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}
Loading

0 comments on commit 4757695

Please sign in to comment.