Skip to content

Commit 891964c

Browse files
feat: Build for release
0 parents  commit 891964c

File tree

600 files changed

+113084
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

600 files changed

+113084
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.idea
2+
/node_modules
3+
/coverage
4+
/lib

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 Technote
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Release GitHub Actions
2+
3+
[![Build Status](https://github.com/technote-space/release-github-actions/workflows/Build/badge.svg)](https://github.com/technote-space/release-github-actions/actions)
4+
[![Coverage Status](https://coveralls.io/repos/github/technote-space/release-github-actions/badge.svg?branch=master)](https://coveralls.io/github/technote-space/release-github-actions?branch=master)
5+
[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/release-github-actions/badge)](https://www.codefactor.io/repository/github/technote-space/release-github-actions)
6+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/release-github-actions/blob/master/LICENSE)
7+
8+
GitHub actions to auto release.
9+
Once you publish the release, this action will automatically
10+
1. Run build
11+
1. Create branch for release
12+
1. Change tag to release branch
13+
1. Change release tag
14+
15+
## Installation
16+
.github/workflows/release.yml
17+
```yaml
18+
on: release
19+
name: Release
20+
jobs:
21+
release:
22+
name: Release GitHub Actions
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Release GitHub Actions
26+
uses: technote-space/release-github-actions@v1
27+
with:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
30+
```
31+
32+
## ACCESS_TOKEN
33+
1. Generate a [personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) with the public_repo or repo scope.
34+
(repo is required for private repositories).
35+
1. [Save as secrets](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables)
36+
37+
## Details
38+
### Target event
39+
- release
40+
### Target action
41+
- published
42+
### Branch name
43+
- Tag name
44+
45+
## Options
46+
### BUILD_COMMAND
47+
Build command.
48+
default: `''`
49+
- If package.json includes build or production or prod in scripts, the command is used for build.
50+
- If command does not have install command like `npm run install` or `yarn install`, install commands are added.
51+
- If command is not provided, `rm -rdf .github` command is added.
52+
53+
so if `BUILD_COMMAND` is not provided and package.json has `build` script,
54+
the following commands are executed.
55+
```shell
56+
yarn install
57+
yarn build
58+
yarn install --production
59+
rm -rdf .github
60+
```
61+
62+
### COMMIT_MESSAGE
63+
Commit message.
64+
default: `'feat: Build for release'`
65+
66+
### COMMIT_NAME
67+
Commit name.
68+
default: `'GitHub Actions'`
69+
70+
### COMMIT_EMAIL
71+
Commit email.
72+
default: `'[email protected]'`

__tests__/fixtures/test2/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "test",
3+
"version": "0.0.1"
4+
}

__tests__/fixtures/test3/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "test",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"test1": "test1",
6+
"test2": "test2"
7+
}
8+
}

__tests__/fixtures/test4/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "test",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"build": "test1",
6+
"production": "test2",
7+
"prod": "test3"
8+
}
9+
}

__tests__/fixtures/test5/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "test",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"production": "test2",
6+
"prod": "test3"
7+
}
8+
}

__tests__/fixtures/test6/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "test",
3+
"version": "0.0.1",
4+
"scripts": {
5+
"prod": "test3"
6+
}
7+
}

__tests__/util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const encodeContent = (content: string) => Buffer.from(content).toString('base64');

0 commit comments

Comments
 (0)