-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add actions to build PRs and develop, cleanup closed PRs. #1172
Changes from all commits
44874b4
2907354
ba06fd3
5d2f2de
4a43389
fcd7b1c
caed4bc
6f0fdf2
b3612da
36f4963
93a438c
72c853e
fec6cca
30ed8e4
64bbc86
d048a32
d1073c8
0545345
0cee859
0d5da4a
b4cac9e
5f2a962
1c22b82
1e24d8a
1051d69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: build-pr | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This runs on pushes to If so that seems fine, but just wanna make sure this isn't going to spawn a lot of ZIP files 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The generated zip files are renamed as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: the github.ref in this case is |
||
pull_request: | ||
adamsilverstein marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a nice touch. I usually just specify the node version in the action, but I like that! 👍 |
||
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 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love how this works! |
||
- 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 }} |
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 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we build the PR on any tags/and on
master
it would save us (usually @felixarntz) having to build the production ZIP by hand on a Mac. Having the CI generate our builds instead of us doing it manually is way nicer, so I filed #1196 to chat about that and extend this later 😄There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call!