Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
e committed Nov 5, 2022
1 parent 866e68e commit 6c2c524
Show file tree
Hide file tree
Showing 12 changed files with 1,318 additions and 1,075 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 16.x

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive
Expand All @@ -36,20 +36,19 @@ jobs:

steps:
- name: Setup node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 12.x
node-version: 16.x

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Extract
id: extract
run: |
echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT

- name: Checkout pre-built
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: release-${{ steps.extract.outputs.branch }}
path: prebuilt
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12.16.2-slim
FROM node:16.3.0-buster-slim

# Install latest yarn
RUN set -eux \
Expand Down
194 changes: 108 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ This GitHub action reduces CI execution time by pre-building JavaScript, TypeScr
## What does this action do to make it pre-built?

### JavaScript / TypeScript action

This action compiles JavaScript GitHub Action into a single file (with cache files if you want), and pushes it to GitHub.
Compilation is powered by [zeit/ncc](https://github.com/zeit/ncc).

TypeScript is also supported. Specify your *.ts file to `action.yml#runs.main`
TypeScript is also supported. Specify your \*.ts file to `action.yml#runs.main`

Since there is no need to commit `node_modules`, your GitHub Action can be released quickly
with less time for pushes during action development and pulls during CI execution.
Expand All @@ -17,6 +18,7 @@ with less time for pushes during action development and pulls during CI executio
> [See pre-built commit](https://github.com/satackey/push-js-action/tree/release-master)
### Docker container action

This action builds an image from your Dockerfile, and pushes it to the Docker registry,
and rewrites `action.yml#rans.image` by pushed tag.

Expand All @@ -32,15 +34,17 @@ The description `action.yml` can be read as `action.yaml`.
### JavaScript / TypeScript

#### Example (Step only)

```yaml
- uses: satackey/[email protected]
with:
push-branch: release-master
- uses: satackey/[email protected]
with:
push-branch: release-master
```
[Click here](#javascript--typescript-action-example) to see workflow example
#### Basic flow
1. This action detects that your action is a JS/TS action by `action.yml`
1. This action compiles a file (e.g. `index.js`) specified in `action.yml#runs.main` into `dist/index.js`
1. Replaces the value of `runs.main` with `dist/index.js`.
Expand All @@ -50,67 +54,76 @@ The description `action.yml` can be read as `action.yaml`.
1. Force push new branch (and tags) to the `origin`

#### Basic inputs

<!-- COMMON DESCRIPTION -->

- `push-branch` **Required**
The name of branch to push compiled file.
The name of branch to push compiled file.

<!-- COMMON DESCRIPTION -->

- `release-tags` optional
The names to tag the compiled file commit.
The names to tag the compiled file commit.

<!-- COMMON DESCRIPTION -->

- `commit-message` optional, default: `[auto]`
The commit message for the compiled.
The commit message for the compiled.

#### Advanced configrations

<details>
<summary>Click here to expand</summary>

<!-- COMMON DESCRIPTION -->

- `committer-name` **Required**
default: `github-actions`
The name to set as git `user.name`.
default: `github-actions`
The name to set as git `user.name`.

<!-- COMMON DESCRIPTION -->

- `committer-email` **Required**
default: `[email protected]`
The email to set as git `user.email`.
default: `[email protected]`
The email to set as git `user.email`.

<!-- COMMON DESCRIPTION -->

- `execlude-from-cleanup` **Required**
default: `action.yml action.yaml dist .git`
Files/dirs to leave for commit.
default: `action.yml action.yaml dist .git`
Files/dirs to leave for commit.

<!-- COMMON DESCRIPTION -->

- `force-push` **Required**
default: `'true'`
Whether to force push to branch or tags.
Either 'true' or 'false'.
default: `'true'`
Whether to force push to branch or tags.
Either 'true' or 'false'.

- `js-build-command` **Required**
default: `ncc build --v8-cache {main}`
The command and arguments to build JavaScript or TypeScript files.
The artifacts must be in the dist/ directory and entrypoint must be dist/index.js.
default: `ncc build --v8-cache {main}`
The command and arguments to build JavaScript or TypeScript files.
The artifacts must be in the dist/ directory and entrypoint must be dist/index.js.
</details>


### Docker container

#### Example (step only)

```yaml
- uses: satackey/[email protected]
with:
push-branch: release-<your_branch_name>
docker-registry: docker.io
docker-user: <your_dockerhub_username>
docker-token: <your_dockerhub_access_token>
docker-repotag: <your_repo>:${{ github.sha }}
- uses: satackey/[email protected]
with:
push-branch: release-<your_branch_name>
docker-registry: docker.io
docker-user: <your_dockerhub_username>
docker-token: <your_dockerhub_access_token>
docker-repotag: <your_repo>:${{ github.sha }}
```

[Click here](#docker-container-action-example) to see workflow example

#### Basic flow

1. This action detects that your action is a Docker container action by `action.yml`
1. This action builds the Dockerfile specifed in `action.yml#runs.image`
1. Replaces the value of `runs.image` with `docker://<docker-repotag>`.
Expand All @@ -121,62 +134,71 @@ The description `action.yml` can be read as `action.yaml`.
1. Force push new branch (and tags) to the `origin`

#### Basic inputs

<!-- COMMON DESCRIPTION -->

- `push-branch` **Required**
The name of branch to push compiled file.
The name of branch to push compiled file.

<!-- COMMON DESCRIPTION -->

- `release-tags` optional
The names to tag the compiled file commit.
The names to tag the compiled file commit.

<!-- COMMON DESCRIPTION -->

- `commit-message` optional, default: `[auto]`
The commit message for the compiled.
The commit message for the compiled.

- `docker-registry` **Required**
The Docker registry's repository of push action image.
The Docker registry's repository of push action image.

- `docker-repotag` **Required**
The Docker registry's repository of push action image.
The Docker registry's repository of push action image.

- `docker-user` **Required**
The username to login to the Docker registry.
The username to login to the Docker registry.

- `docker-token` **Required**
The token to login to the Docker registry.
The token to login to the Docker registry.

#### Advanced configrations

<details>
<summary>Click here to expand</summary>

<!-- COMMON DESCRIPTION -->

- `committer-name` **Required**
default: `github-actions`
The name to set as git `user.name`.
default: `github-actions`
The name to set as git `user.name`.

<!-- COMMON DESCRIPTION -->

- `committer-email` **Required**
default: `[email protected]`
The email to set as git `user.email`.
default: `[email protected]`
The email to set as git `user.email`.

<!-- COMMON DESCRIPTION -->

- `execlude-from-cleanup` **Required**
default: `action.yml action.yaml dist .git`
Files/dirs to leave for commit.
default: `action.yml action.yaml dist .git`
Files/dirs to leave for commit.

<!-- COMMON DESCRIPTION -->

- `force-push` **Required**
default: `'true'`
Whether to force push to branch or tags.
Either 'true' or 'false'.
default: `'true'`
Whether to force push to branch or tags.
Either 'true' or 'false'.

- `docker-build-command` **Required**
default: `'true'`
The command and arguments to build Docker image.
default: `'true'`
The command and arguments to build Docker image.
</details>

## Contribution

PRs are accepted.

If you are having trouble or feature request, [post new issue](https://github.com/satackey/push-js-action/issues/new).
Expand All @@ -191,33 +213,33 @@ name: Push pre-built action
on:
push:
branches:
- '**'
- "**"
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Checkout
uses: actions/checkout@v2
- name: Output branch name
id: name
run: echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
- name: Push
uses: satackey/[email protected]
with:
push-branch: release-${{ steps.name.outputs.branch }}
# [optional] The commit can be tagged.
# release-tags: v1 v1.0 v1.0.0
# [optional] You can change he commit message.
# commit-message: '[ci skip]'
- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Checkout
uses: actions/checkout@v2
- name: Output branch name
id: name
run: echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
- name: Push
uses: satackey/[email protected]
with:
push-branch: release-${{ steps.name.outputs.branch }}
# [optional] The commit can be tagged.
# release-tags: v1 v1.0 v1.0.0
# [optional] You can change he commit message.
# commit-message: '[ci skip]'
```

The distribution is pushed into `release-<your_branch>` like `release-master`.
Expand All @@ -230,32 +252,32 @@ name: Push pre-built action
on:
push:
branches:
- '**'
- "**"
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Output branch name
id: name
run: echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
- name: Push
uses: satackey/[email protected]
with:
push-branch: release-${{ steps.name.outputs.branch }}
# [optional] The commit can be tagged.
# release-tags: v1 v1.0 v1.0.0
# [optional] You can change he commit message.
# commit-message: '[ci skip]'
docker-registry: docker.io
docker-user: <your_dockerhub_username>
docker-token: ${{ secrets.DOCKERHUB_TOKEN }} # your dockerhub access token
docker-repotag: <your_repo>:${{ github.sha }}
- name: Checkout
uses: actions/checkout@v2
- name: Output branch name
id: name
run: echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
- name: Push
uses: satackey/[email protected]
with:
push-branch: release-${{ steps.name.outputs.branch }}
# [optional] The commit can be tagged.
# release-tags: v1 v1.0 v1.0.0
# [optional] You can change he commit message.
# commit-message: '[ci skip]'
docker-registry: docker.io
docker-user: <your_dockerhub_username>
docker-token: ${{ secrets.DOCKERHUB_TOKEN }} # your dockerhub access token
docker-repotag: <your_repo>:${{ github.sha }}
```

The distribution is pushed into `release-<your_branch>` like `release-master`.
Loading

0 comments on commit 6c2c524

Please sign in to comment.