chains/.github/workflows/build_and_deploy.yml

35 lines
1.0 KiB
YAML
Raw Normal View History

name: Build and Deploy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.1
- name: Build
run: |
./gradlew run
# deploy to github pages only when on master
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
id: extract_branch
2021-07-04 23:16:00 +00:00
- name: Checkout
uses: actions/checkout@v2.3.1
if: ${{ github.event_name != 'pull_request' && steps.extract_branch.outputs.branch == 'master' }}
2021-07-04 23:16:00 +00:00
- name: Build
run: |
./gradlew run
if: ${{ github.event_name != 'pull_request' && steps.extract_branch.outputs.branch == 'master' }}
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages
folder: output
if: ${{ github.event_name != 'pull_request' && steps.extract_branch.outputs.branch == 'master' }}