-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1172 from google/feature/add-repo-actions
Add actions to build PRs and develop, cleanup closed PRs.
- Loading branch information
Showing
3 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters