This GitHub action reduces CI execution time by pre-building JavaScript, TypeScript, and Docker container actions.
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.
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.
This Action written in TypeScript has been compiled by itself and released. See pre-built commit
This action builds an image from your Dockerfile, and pushes it to the Docker registry,
and rewrites action.yml#rans.image
by pushed tag.
The job just pulls Docker image when using the action, and there's no time to build the Dockerfile.
The description action.yml
can be read as action.yaml
.
- uses: satackey/[email protected]
with:
push-branch: release-master
Click here to see workflow example
- This action detects that your action is a JS/TS action by
action.yml
- This action compiles a file (e.g.
index.js
) specified inaction.yml#runs.main
intodist/index.js
- Replaces the value of
runs.main
withdist/index.js
. - Remove files exclude
/action.yml
anddist/*
. - Checkout a new branch with the name specified in
push-branch
. - Commit all changes.
- Force push new branch (and tags) to the
origin
push-branch
Required
The name of branch to push compiled file.
release-tags
optional
The names to tag the compiled file commit.
commit-message
optional, default:[auto]
The commit message for the compiled.
Click here to expand
committer-name
Required
default:github-actions
The name to set as gituser.name
.
committer-email
Required
default:[email protected]
The email to set as gituser.email
.
execlude-from-cleanup
Required
default:action.yml action.yaml dist .git
Files/dirs to leave for commit.
-
force-push
Required
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.
- 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 to see workflow example
- This action detects that your action is a Docker container action by
action.yml
- This action builds the Dockerfile specifed in
action.yml#runs.image
- Replaces the value of
runs.image
withdocker://<docker-repotag>
. - Remove files exclude
/action.yml
. - Checkout a new branch with the name specified in
push-branch
. - Commit all changes.
- Push the Docker image
<docker-repotag>
to the Docker registry<docker-registry>
. - Force push new branch (and tags) to the
origin
push-branch
Required
The name of branch to push compiled file.
release-tags
optional
The names to tag the compiled file commit.
-
commit-message
optional, default:[auto]
The commit message for the compiled. -
docker-registry
Required
The Docker registry's repository of push action image. -
docker-repotag
Required
The Docker registry's repository of push action image. -
docker-user
Required
The username to login to the Docker registry. -
docker-token
Required
The token to login to the Docker registry.
Click here to expand
committer-name
Required
default:github-actions
The name to set as gituser.name
.
committer-email
Required
default:[email protected]
The email to set as gituser.email
.
execlude-from-cleanup
Required
default:action.yml action.yaml dist .git
Files/dirs to leave for commit.
-
force-push
Required
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.
PRs are accepted.
If you are having trouble or feature request, post new issue.
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]'
The distribution is pushed into release-<your_branch>
like release-master
.
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 }}
The distribution is pushed into release-<your_branch>
like release-master
.