Skip to content

Commit

Permalink
improve github action setup (#4718)
Browse files Browse the repository at this point in the history
  • Loading branch information
connyduck authored Oct 10, 2024
1 parent 9bb1329 commit a366d49
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
18 changes: 18 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Setup build environment'
description: 'Sets up an environment for building Tusky'
runs:
using: "composite"
steps:
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Copy CI gradle.properties
shell: bash
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Gradle Build Action
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
14 changes: 2 additions & 12 deletions .github/workflows/check-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Gradle Build Action
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
- name: Setup
uses: ./.github/actions/setup

- name: ktlint
run: ./gradlew clean ktlintCheck
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ on:
- '*'

jobs:
build:
check-and-build:
uses: ./.github/workflows/check-and-build.yml
deploy:
runs-on: ubuntu-latest
needs: check-and-build
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ./.github/workflows/check-and-build.yml
- name: Setup
uses: ./.github/actions/setup

- name: Build Blue aab
run: ./gradlew app:bundleBlueRelease
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ on:
- develop

jobs:
build:
check-and-build:
uses: ./.github/workflows/check-and-build.yml
deploy:
runs-on: ubuntu-latest
needs: check-and-build
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ./.github/workflows/check-and-build.yml
- name: Setup
uses: ./.github/actions/setup

- name: Build Green aab
run: ./gradlew app:bundleGreenRelease
Expand Down

0 comments on commit a366d49

Please sign in to comment.