Skip to content

Commit

Permalink
Merge pull request #1172 from google/feature/add-repo-actions
Browse files Browse the repository at this point in the history
Add actions to build PRs and develop, cleanup closed PRs.
  • Loading branch information
felixarntz committed Mar 2, 2020
2 parents 8b75b99 + 1051d69 commit 607a42f
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
83 changes: 83 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: build-pr

on:
push:
branches:
- develop
pull_request:

jobs:
build-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Composer Install
uses: php-actions/composer@v1
with:
args: install
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Setup Node.js (.nvmrc)
uses: actions/setup-node@v1
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
- name: Cache Node - npm
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-cache-
- name: npm install
run: |
npm install
- name: Create destination directory
run: mkdir -p ${{ github.ref }}
- name: Build develop version
run: |
npm run dev-zip
mv *.zip ${{ github.ref }}/google-site-kit-dev.zip
- name: Build release version
run: |
npm run release-zip
mv *.zip ${{ github.ref }}/google-site-kit.zip
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: zip-files
path: ${{ github.ref }}

deploy-to-wiki:
runs-on: ubuntu-latest
needs: build-pr
steps:
- uses: actions/checkout@v2
with:
repository: ${{ github.repository }}.wiki
- name: Download artifacts
uses: actions/download-artifact@v1
with:
name: zip-files
path: ${{ github.ref }}
- name: Commit updates
run: |
git add .
git status
git commit -m "Build and publish ${{ github.ref }}"
git push origin master
env:
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_AUTHOR_NAME: ${{ github.actor }}
GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_COMMITTER_NAME: ${{ github.actor }}
24 changes: 24 additions & 0 deletions .github/workflows/remove-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: remove-pr

on:
pull_request:
types: [closed]
jobs:
remove-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
repository: ${{ github.repository }}.wiki
- name: Prune PR files
run: |
rm -rf ${{ github.ref }}
git add .
git status
git commit -m "Prune ${{ github.ref }}"
git push origin master
env:
GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_AUTHOR_NAME: ${{ github.actor }}
GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_COMMITTER_NAME: ${{ github.actor }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"build": "npm run remove-dist && npm run build:production && npm run build:static",
"build:production": "webpack -p --mode=production",
"build:test": "webpack -p --mode=production --include-tests",
"build:dev": "npm run build:static && webpack --mode=development --debug --devtool cheap-source-map --output-pathinfo",
"build:dev": "npm run remove-dist && npm run build:static && webpack --mode=development --debug --devtool cheap-source-map --output-pathinfo",
"build:static": "gulp svg imagemin",
"dev": "npm run build:dev && npm run build:static",
"dev-zip": "npm run build:dev && gulp release",
"watch": "npm run remove-dist && npm run build:static && webpack --watch --mode=development --debug --devtool cheap-module-eval-source-map --output-pathinfo",
"release-zip": "npm run build && gulp release",
"remove-dist": "rm -rf dist/*",
Expand Down

0 comments on commit 607a42f

Please sign in to comment.