Skip to content

Commit 4216ea1

Browse files
authored
Enable workflows for releases (googleworkspace#393)
1 parent 41ca295 commit 4216ea1

File tree

6 files changed

+76
-13
lines changed

6 files changed

+76
-13
lines changed

.github/snippet-bot.yml

Whitespace-only changes.

.github/workflows/lint.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
---
1515
name: Lint
16-
on: [push, pull_request]
16+
on: [push, pull_request, workflow_dispatch]
1717
jobs:
1818
lint:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v2
22-
- run: |
23-
echo "No lint checks";
24-
exit 1;
22+
- uses: actions/setup-node@v1
23+
with:
24+
node-version: 16
25+
- name: Install dependencies
26+
run: npm ci
27+
- name: Lint files
28+
run: npm run lint

.github/workflows/release-please.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
name: release-please
6+
jobs:
7+
release-please:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: google-github-actions/release-please-action@v3
11+
with:
12+
token: ${{secrets.GOOGLEWORKSPACE_BOT_TOKEN}}
13+
release-type: node
14+
package-name: release-please-action
15+
- uses: actions/checkout@v2
16+
if: ${{ steps.release.outputs.release_created }}
17+
- uses: actions/setup-node@v1
18+
if: ${{ steps.release.outputs.release_created }}
19+
with:
20+
node-version: 16
21+
- name: Write test credentials
22+
if: ${{ steps.release.outputs.release_created }}
23+
run: |
24+
echo "${CLASP_CREDENTIALS}" > "${HOME}/.clasprc.json"
25+
env:
26+
CLASP_CREDENTIALS: ${{secrets.LIBRARIES_OWNER_CLASP_TOKEN}}
27+
- name: Depoy scripts
28+
if: ${{ steps.release.outputs.release_created }}
29+
run: |
30+
cd src
31+
npx @google/clasp push
32+
MESSAGE=$(git log -1 --pretty=%B) npx @google/clasp version ${MESSAGE}

.github/workflows/test.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
---
1515
name: Test
16-
on: [push, pull_request]
16+
on: [push, pull_request, workflow_dispatch]
1717
jobs:
1818
test:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v2
22-
- run: |
23-
echo "No tests";
24-
exit 1;
22+
- uses: actions/setup-node@v1
23+
with:
24+
node-version: 16
25+
- name: Install dependencies
26+
run: npm ci
27+
- name: Run tests
28+
run: npm run test

.github/workflows/update-dist.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
on: [pull_request]
2+
name: Update dist folder
3+
jobs:
4+
update-dist-src:
5+
if: "${{ contains(github.event.pull_request.labels.*.name, 'autorelease: pending') }}"
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
with:
10+
ref: ${{ github.event.pull_request.head.ref }}
11+
token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }}
12+
- uses: actions/setup-node@v1
13+
with:
14+
node-version: 16
15+
- name: Install dependencies
16+
run: npm ci
17+
- name: Update dist and doc folders
18+
run: |
19+
npm run dist
20+
npm run docs
21+
- uses: stefanzweifel/git-auto-commit-action@v4
22+
with:
23+
commit_message: "chore: Update dist/ and docs/ directories"
24+
commit_user_name: Google Workspace Bot
25+
commit_user_email: googleworkspace-bot@google.com
26+
commit_author: Google Workspace Bot <googleworkspace-bot@google.com>

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
"urlsafe-base64": "1.0.0"
3333
},
3434
"scripts": {
35-
"preversion": "npm test && cd src/ && clasp push",
36-
"version": "npm run dist && npm run doc && git add -A dist docs",
37-
"postversion": "MESSAGE=$(git log -1 --pretty=%B) && cd src/ && clasp version $MESSAGE",
3835
"dist": "gulp dist",
3936
"lint": "gulp lint",
4037
"doc": "jsdoc -c jsdoc.json src/*.js README.md",

0 commit comments

Comments
 (0)