Skip to content

Commit

Permalink
feat(action): build as an javascript action (#331)
Browse files Browse the repository at this point in the history
This switches the GitHub action to be a javascript action (from Docker). This is orders of magnitude faster to run -- no more docker build (or download) on every invocation.

The downside is that we must compile the dist file before each release. This is accomplished via a new workflow that runs on pushes to main that will open a new PR if there are changes to the dist output.

Fixes #141
  • Loading branch information
chingor13 committed Feb 28, 2022
1 parent f4a32d4 commit 257305d
Show file tree
Hide file tree
Showing 22 changed files with 22,371 additions and 90 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Expand Up @@ -5,3 +5,4 @@ build/
docs/
protos/
samples/generated/
dist/
47 changes: 47 additions & 0 deletions .github/workflows/build-action.yaml
@@ -0,0 +1,47 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

on:
push:
branches:
- main
name: build-action
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: build
run: |-
set -e
npm i
npm run compile
pushd action
npm ci
npm run package
- name: googleapis/code-suggester@v2
env:
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
with:
command: pr
upstream_owner: googleapis
upstream_repo: code-suggester
description: 'Compiles the code-suggester action dist'
title: 'build(action): build dist'
message: 'build(action): build dist'
branch: build-dist
primary: main
fork: true
force: true
git_dir: './action/dist'
21 changes: 21 additions & 0 deletions .github/workflows/ci-action.yaml
@@ -0,0 +1,21 @@
on:
push:
branches:
- main
pull_request:
name: ci-action
jobs:
test-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: |-
set -e
npm i
npm run compile
pushd action
npm ci
npm test
1 change: 1 addition & 0 deletions .prettierignore
Expand Up @@ -4,3 +4,4 @@ test/fixtures
build/
docs/
protos/
dist/
27 changes: 0 additions & 27 deletions Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions action.yaml
Expand Up @@ -54,5 +54,5 @@ inputs:
labels:
description: Labels to add to the pull request being opened.
runs:
using: docker
image: Dockerfile
using: 'node12'
main: 'action/dist/index.js'
8 changes: 8 additions & 0 deletions action/.eslintignore
@@ -0,0 +1,8 @@
**/node_modules
**/coverage
test/fixtures
build/
docs/
protos/
samples/generated/
dist/

0 comments on commit 257305d

Please sign in to comment.