Skip to content

Commit

Permalink
Get rid of duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
BramDC3 committed Sep 11, 2024
1 parent 34eabee commit b6111fa
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 101 deletions.
23 changes: 23 additions & 0 deletions .github/actions/prepare-macos-runner/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Prepare macOS runner"
description: "Prepare macOS runner"
runs:
using: "composite"
steps:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
shell: bash
run: bundle install

- name: Install FVM
shell: bash
run: |
brew tap leoafarias/fvm
brew install fvm
- name: Set up FVM
shell: bash
run: fvm use
21 changes: 21 additions & 0 deletions .github/actions/prepare-ubuntu-runner/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Prepare Ubuntu runner"
description: "Prepare Ubuntu runner"
runs:
using: "composite"
steps:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
shell: bash
run: bundle install

- name: Install FVM
shell: bash
run: curl -fsSL https://fvm.app/install.sh | bash

- name: Set up FVM
shell: bash
run: fvm use
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
name: default-workflow
on:
push:
branches:
- main
on: [push]
# on:
# push:
# branches:
# - main
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
run: bundle install

- name: Install FVM
run: curl -fsSL https://fvm.app/install.sh | bash

- name: Set up FVM
run: fvm use
- name: Prepare runner
uses: ./.github/actions/prepare-ubuntu-runner

- name: Run virtual machine tests
run: bundle exec fastlane run_vm_tests
Expand All @@ -34,19 +24,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
run: bundle install

- name: Install FVM
run: curl -fsSL https://fvm.app/install.sh | bash

- name: Set up FVM
run: fvm use
- name: Prepare runner
uses: ./.github/actions/prepare-ubuntu-runner

- name: Decode and save google-services.json
run: echo "${{ secrets.GOOGLE_SERVICES_JSON }}" | base64 -d > ./android/app/google-services.json
Expand All @@ -67,21 +46,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
run: bundle install

- name: Install FVM
run: |
brew tap leoafarias/fvm
brew install fvm
- name: Set up FVM
run: fvm use
- name: Prepare runner
uses: ./.github/actions/prepare-macos-runner

- name: Decode and save GoogleServices-Info.plist
run: echo "${{ secrets.GOOGLESERVICE_INFO_PLIST }}" | base64 -d > ./ios/Runner/GoogleService-Info.plist
Expand Down
67 changes: 11 additions & 56 deletions .github/workflows/release-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
run: bundle install

- name: Install FVM
run: curl -fsSL https://fvm.app/install.sh | bash

- name: Set up FVM
run: fvm use
- name: Prepare runner
uses: ./.github/actions/prepare-ubuntu-runner

- name: Run virtual machine tests
run: bundle exec fastlane run_vm_tests
Expand All @@ -36,19 +25,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
run: bundle install

- name: Install FVM
run: curl -fsSL https://fvm.app/install.sh | bash

- name: Set up FVM
run: fvm use
- name: Prepare runner
uses: ./.github/actions/prepare-ubuntu-runner

- name: Decode and save google-services.json
run: echo "${{ secrets.GOOGLE_SERVICES_JSON }}" | base64 -d > ./android/app/google-services.json
Expand Down Expand Up @@ -81,21 +59,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
run: bundle install

- name: Install FVM
run: |
brew tap leoafarias/fvm
brew install fvm
- name: Set up FVM
run: fvm use
- name: Prepare runner
uses: ./.github/actions/prepare-macos-runner

- name: Decode and save GoogleServices-Info.plist
run: echo "${{ secrets.GOOGLESERVICE_INFO_PLIST }}" | base64 -d > ./ios/Runner/GoogleService-Info.plist
Expand Down Expand Up @@ -132,13 +97,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
run: bundle install
- name: Prepare runner
uses: ./.github/actions/prepare-ubuntu-runner

- name: Decode and save Firebase App Distribution service account
run: echo "${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_JSON }}" | base64 -d > ./FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT.json
Expand All @@ -154,18 +114,13 @@ jobs:

distribute_ios:
name: Distribute iOS release
runs-on: macos-latest
runs-on: ubuntu-latest
needs: [build_android, build_ios]
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.1" # TODO: keep this somewhere where it's easy to change

- name: Install gems
run: bundle install
- name: Prepare runner
uses: ./.github/actions/prepare-ubuntu-runner

- name: Decode and save Firebase App Distribution service account
run: echo "${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_JSON }}" | base64 -d > ./FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT.json
Expand Down

0 comments on commit b6111fa

Please sign in to comment.