Skip to content

Commit

Permalink
feat: Add code (#1)
Browse files Browse the repository at this point in the history
* Initial

* Update docs

* remove dist/

* debug

* Remove comments

* dependabot

* update version

* fix version

* lint

* debug

* debug

* debug

* node

* test

* test path

* format

* debug

* gcloud version

* clean up

* remove unnecessary cleanup

* update tests

* Update docs

* update package

* extend timeout

* respond to comments

* lint

* fix concat

* add skip for winos
  • Loading branch information
averikitsch committed Sep 24, 2021
1 parent 657ad2b commit 04bfb81
Show file tree
Hide file tree
Showing 33 changed files with 13,308 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2021 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.
*/

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'prettier/@typescript-eslint',
],
};
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
commit-message:
prefix: "chore(deps): "
rebase-strategy: "disabled"
17 changes: 17 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on: pull_request_target

jobs:
apply-label:
if: github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Fork']
})
87 changes: 87 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
on:
push:
branches:
- main

name: build and release-please
env:
PACKAGE_NAME: setup-cloud-sdk

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: git pull
- name: install
run: npm install
- name: build
run: npm run build
- name: docs
run: npm run docs
- name: commit
run: |-
set -e
# get current commit hash
CURRENT_HASH=$(git rev-parse HEAD)
# get last commit hash of last build dist
LAST_BUILD_HASH=$(git log --author=google-github-actions-bot -1 --pretty=format:"%H")
DIFF=""
# build and commit dist if diff
git config --global user.name "actions-bot"
git config user.email 'github-actions-bot@google.com'
git add dist/
git diff-index --quiet HEAD || git commit -m "chore: build dist ${PACKAGE_NAME}"
# if last commit hash of last build dist was found, get logs of commits in btw for PR body
if [ -z "$LAST_BUILD_HASH" ]
then
echo "Unable to find last commit by bot, skipping diff gen"
else
DIFF=$(git log ${LAST_BUILD_HASH}...${CURRENT_HASH} --oneline)
echo $DIFF
fi
# set env vars
echo "CURRENT_HASH=${CURRENT_HASH}" >> $GITHUB_ENV
echo "LAST_BUILD_HASH=${LAST_BUILD_HASH}" >> $GITHUB_ENV
echo 'DIFF<<EOF' >> $GITHUB_ENV
echo "${DIFF}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
commit-message: Build dist
author: "actions-bot <github-actions-bot@google.com>"
title: "chore: build dist"
body: |
Build dist PR
${{env.DIFF}}
labels: automated pr
branch: create-pull-request/build-dist
delete-branch: true
push-to-fork: google-github-actions-bot/${{env.PACKAGE_NAME}}
release-please-pr:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: google-github-actions/release-please-action@main
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
release-type: node
bump-minor-pre-major: true
fork: true
package-name: ${{env.PACKAGE_NAME}}
command: release-pr
release-please-release:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: google-github-actions/release-please-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
bump-minor-pre-major: true
package-name: ${{env.PACKAGE_NAME}}
command: github-release
32 changes: 32 additions & 0 deletions .github/workflows/setup-cloud-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: setup-cloud-sdk Unit

on: [pull_request]

jobs:
run:
name: Unit Tests
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
node: [10, 12, 14]
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@master
with:
node-version: 12.x

- name: npm install
run: npm install

- name: npm lint
run: npm run lint

- name: npm test
run: npm run test
env:
KEY: ${{ secrets.SETUP_SDK_CRED_SA_KEY_JSON }}
B64_KEY: ${{ secrets.SETUP_SDK_CRED_SA_KEY_B64 }}
PROJECT_ID: ${{ secrets.SETUP_SDK_CRED_PROJECT_ID }}

46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
node_modules/
__tests__/runner/*
runner/

# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
30 changes: 30 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2021 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.
*/

module.exports = {
arrowParens: 'always',
bracketSpacing: true,
endOfLine: 'auto',
jsxBracketSameLine: true,
jsxSingleQuote: true,
printWidth: 80,
quoteProps: 'consistent',
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
};
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @google-github-actions/maintainers
44 changes: 44 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--
Copyright 2021 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
https://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.
-->
# How to contribute

We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.

## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution,
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.

You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.

## Branching Model

This repository uses the [Gitflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) branching model.

## Code reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

## Style Guide

This project conforms to the [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html). All submitted PRs will be required to conform to this style guide before being merged.
Loading

0 comments on commit 04bfb81

Please sign in to comment.