Skip to content

Commit 9433416

Browse files
authored
Merge pull request #1 from elstudio/master
Update to actions v2 syntax.
2 parents f71b6bc + e7ce974 commit 9433416

File tree

16 files changed

+145
-125
lines changed

16 files changed

+145
-125
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

Brewfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,32 @@ This repository contains two actions that may be used independently -- typically
1414

1515
An example workflow to run `grunt default` task to build, test, then commit and push any changes back to the GitHub origin repository:
1616

17-
```hcl
18-
workflow "Grunt compile" {
19-
on = "push"
20-
resolves = ["Commit and Push"]
21-
}
22-
23-
action "Build" {
24-
uses = "elstudio/actions-js-build/build@master"
25-
env = {
26-
WD_PATH = "./web/themes/nw8"
27-
}
28-
args = "default"
29-
}
30-
31-
action "Commit and Push" {
32-
uses = "elstudio/actions-js-build/commit@master"
33-
needs = ["Build"]
34-
secrets = ["GITHUB_TOKEN"]
35-
env = {
36-
PUSH_BRANCH = "staging"
37-
}
38-
}
17+
```yaml
18+
name: Grunt build and commit updated stylesheets
19+
20+
on: [push]
21+
22+
jobs:
23+
grunt-build:
24+
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v1
29+
30+
- name: Compile with Grunt
31+
uses: elstudio/actions-js-build/build@v2
32+
env:
33+
WD_PATH: './web/themes/nw8'
34+
35+
- name: Commit changes
36+
uses: elstudio/actions-js-build/commit@v2
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
PUSH_BRANCH: 'staging'
3940
```
4041
42+
4143
### Secrets
4244
4345
* `GITHUB_TOKEN` - **Required**. The token to use for authentication with GitHub to commit and push changes back to the origin repository. ([more info](https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables))

build/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:lts-alpine
1+
FROM node:10-alpine
22

33
LABEL version="1.0.0"
44
LABEL repository="https://github.com/elstudio/actions-js-build"

build/README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,32 @@ This Action for [npm](https://www.npmjs.com/) installs any required npm packages
1212

1313
An example workflow to run the `grunt default` task to build, test. The second action commits and pushes any changes back to the GitHub origin repository:
1414

15-
```hcl
16-
workflow "Grunt compile" {
17-
on = "push"
18-
resolves = ["Commit and Push"]
19-
}
20-
21-
action "Build" {
22-
uses = "elstudio/actions-js-build/build@master"
23-
env = {
24-
WD_PATH = "./web/themes/nw8"
25-
}
26-
args = "default"
27-
}
28-
29-
action "Commit and Push" {
30-
uses = "elstudio/actions-js-build/commit@master"
31-
needs = ["Build"]
32-
secrets = ["GITHUB_TOKEN"]
33-
}
34-
```
3515

36-
### Secrets
16+
```yaml
17+
name: Grunt build and commit updated stylesheets
18+
19+
on: [push]
20+
21+
jobs:
22+
grunt-build:
23+
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/checkout@v1
28+
29+
- name: Compile with Grunt
30+
uses: elstudio/actions-js-build/build@v2
31+
env:
32+
WD_PATH: './web/themes/nw8'
33+
34+
- name: Commit changes
35+
uses: elstudio/actions-js-build/commit@v2
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
PUSH_BRANCH: 'staging'
39+
```
3740
38-
* `GITHUB_TOKEN` - **Required**. The token to use for authentication with GitHub to commit and push changes back to the origin repository. ([more info](https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables))
3941
4042
### Environment variables
4143

build/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'GitHub Action to execute javascript build tools'
2+
description: 'Executes npm install, followed by gulp or grunt (whichever has a build file).'
3+
author: 'elstudio'
4+
branding:
5+
icon: 'truck'
6+
color: 'purple'
7+
inputs:
8+
wdPath:
9+
description: 'Working directory path'
10+
required: false
11+
default: ''
12+
debug:
13+
description: 'Print script debugging info'
14+
required: false
15+
default: 'false'
16+
runs:
17+
using: 'docker'
18+
image: 'Dockerfile'
19+
entrypoint: 'entrypoint.sh'
20+
env:
21+
DEBUG: ${{ inputs.debug }}
22+
WD_PATH: ${{ inputs.wdPath }}

build/entrypoint.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
#!/bin/sh
22

3-
set -e
3+
if [ "$DEBUG" == "false" ]
4+
then
5+
# Carry on, but do quit on errors
6+
set -e
7+
else
8+
# Verbose debugging
9+
set -exuo pipefail
10+
export LOG_LEVEL=debug
11+
fi
12+
413

5-
if [ -n "$WD_PATH" ]
14+
if [ ! -z "$WD_PATH" ]
615
then
716
echo "Changing dir to $WD_PATH"
817
cd $WD_PATH

commit/.dockerignore

100755100644
File mode changed.

commit/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:latest
1+
FROM alpine:3.10
22

33
LABEL version="1.0.0"
44
LABEL repository="https://github.com/elstudio/actions-js-build"

commit/README.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,30 @@ This Action for git commits any changed files and pushes those changes back to t
66

77
An example workflow to commit and push any changes back to the GitHub origin repository:
88

9-
```hcl
10-
workflow "Commit and Push" {
11-
on = "push"
12-
resolves = ["Commit and Push"]
13-
}
14-
15-
action "Commit and Push" {
16-
uses = "elstudio/actions-js-build/commit@master"
17-
secrets = ["GITHUB_TOKEN"]
18-
env = {
19-
WD_PATH = "./web/themes/nw8"
20-
PUSH_BRANCH = "staging"
21-
}
22-
}
9+
10+
```yaml
11+
name: Grunt build and commit updated stylesheets
12+
13+
on: [push]
14+
15+
jobs:
16+
grunt-build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v1
22+
23+
- name: Compile with Grunt
24+
uses: elstudio/actions-js-build/build@v2
25+
env:
26+
WD_PATH: './web/themes/nw8'
27+
28+
- name: Commit changes
29+
uses: elstudio/actions-js-build/commit@v2
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
PUSH_BRANCH: 'staging'
2333
```
2434
2535
### Secrets

0 commit comments

Comments
 (0)