Skip to content

Commit

Permalink
Only release after build/test
Browse files Browse the repository at this point in the history
Hopefully one day GitHub Actions supports splitting jobs across files!
  • Loading branch information
will-molloy committed Jun 28, 2023
1 parent 3f339bb commit 765535b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 67 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,51 @@ jobs:
with:
flags: unit-tests
fail_ci_if_error: true

integration-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Java 19
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 19

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Integration Test
run: ./gradlew projects clean integrationTest --no-daemon --refresh-dependencies

- name: Upload coverage to Codecov (Linux only)
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
flags: integration-tests
fail_ci_if_error: true

release:
needs: [ build, integration-test ]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Bump version
id: version
uses: paulhatch/[email protected]

- name: Create GitHub tag and release
uses: softprops/[email protected]
with:
tag_name: ${{ steps.version.outputs.version_tag }}
generate_release_notes: true
35 changes: 0 additions & 35 deletions .github/workflows/integration-test.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# java-gradle-template

[![build](https://github.com/will-molloy/java-gradle-template/workflows/build/badge.svg?branch=main&event=push)](https://github.com/will-molloy/java-gradle-template/actions?query=workflow%3Abuild)
[![integration-test](https://github.com/will-molloy/java-gradle-template/workflows/integration-test/badge.svg?branch=main&event=push)](https://github.com/will-molloy/java-gradle-template/actions?query=workflow%3Aintegration-test)
[![release](https://github.com/will-molloy/java-gradle-template/workflows/release/badge.svg?branch=main&event=push)](https://github.com/will-molloy/java-gradle-template/actions?query=workflow%3Arelease)
[![codecov](https://codecov.io/gh/will-molloy/java-gradle-template/branch/main/graph/badge.svg)](https://codecov.io/gh/will-molloy/java-gradle-template)

template repository for Java projects using Gradle
Expand Down

0 comments on commit 765535b

Please sign in to comment.