Adjust condition to work with master and main branches. #7
This file contains hidden or 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
| name: Build and Publish | |
| on: [ push, pull_request ] | |
| jobs: | |
| build: | |
| name: Test and Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Setup Java 1.8 environment for the next steps | |
| - name: Setup Java | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: 1.8 | |
| # Check out current repository | |
| - name: Fetch Sources | |
| uses: actions/checkout@v2 | |
| # Validate wrapper | |
| - name: Validate Gradle Wrapper | |
| uses: gradle/[email protected] | |
| # Build application | |
| - name: Test and Build | |
| run: ./gradlew build | |
| # If main branch update, deploy to gh-pages | |
| - name: Deploy | |
| if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' | |
| uses: JamesIves/[email protected] | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| BRANCH: gh-pages # The branch the action should deploy to. | |
| FOLDER: build/distributions # The folder the action should deploy. | |
| CLEAN: true # Automatically remove deleted files from the deploy branch |