diff --git a/.github/snippet-bot.yml b/.github/snippet-bot.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c5cb1be8..5a44ff0b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,14 +11,18 @@ # 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. - +--- name: Lint -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: | - echo "No lint checks"; - exit 1; + - uses: actions/setup-node@v1 + with: + node-version: 16 + - name: Install dependencies + run: npm ci + - name: Lint files + run: npm run lint \ No newline at end of file diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..c556197d --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,32 @@ +on: + push: + branches: + - main +name: release-please +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v3 + with: + token: ${{secrets.GOOGLEWORKSPACE_BOT_TOKEN}} + release-type: node + package-name: release-please-action + - uses: actions/checkout@v2 + if: ${{ steps.release.outputs.release_created }} + - uses: actions/setup-node@v1 + if: ${{ steps.release.outputs.release_created }} + with: + node-version: 16 + - name: Write test credentials + if: ${{ steps.release.outputs.release_created }} + run: | + echo "${CLASP_CREDENTIALS}" > "${HOME}/.clasprc.json" + env: + CLASP_CREDENTIALS: ${{secrets.LIBRARIES_OWNER_CLASP_TOKEN}} + - name: Depoy scripts + if: ${{ steps.release.outputs.release_created }} + run: | + cd src + npx @google/clasp push + MESSAGE=$(git log -1 --pretty=%B) npx @google/clasp version ${MESSAGE} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index debf4655..b9cea5d0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,14 +11,18 @@ # 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. - +--- name: Test -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: | - echo "No tests"; - exit 1; + - uses: actions/setup-node@v1 + with: + node-version: 16 + - name: Install dependencies + run: npm ci + - name: Run tests + run: npm run test \ No newline at end of file diff --git a/.github/workflows/update-dist.yml b/.github/workflows/update-dist.yml new file mode 100644 index 00000000..c783bf8d --- /dev/null +++ b/.github/workflows/update-dist.yml @@ -0,0 +1,26 @@ +on: [pull_request] +name: Update dist folder +jobs: + update-dist-src: + if: "${{ contains(github.event.pull_request.labels.*.name, 'autorelease: pending') }}" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ secrets.GOOGLEWORKSPACE_BOT_TOKEN }} + - uses: actions/setup-node@v1 + with: + node-version: 16 + - name: Install dependencies + run: npm ci + - name: Update dist and doc folders + run: | + npm run dist + npm run docs + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "chore: Update dist/ and docs/ directories" + commit_user_name: Google Workspace Bot + commit_user_email: googleworkspace-bot@google.com + commit_author: Google Workspace Bot diff --git a/package.json b/package.json index 3ca3bced..d9891035 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,6 @@ "urlsafe-base64": "1.0.0" }, "scripts": { - "preversion": "npm test && cd src/ && clasp push", - "version": "npm run dist && npm run doc && git add -A dist docs", - "postversion": "MESSAGE=$(git log -1 --pretty=%B) && cd src/ && clasp version $MESSAGE", "dist": "gulp dist", "lint": "gulp lint", "doc": "jsdoc -c jsdoc.json src/*.js README.md",