Skip to content

Commit

Permalink
chore: improve GH workflows (#1588)
Browse files Browse the repository at this point in the history
* refactor: make ios to a re-usable workflow

* refactor: make android to a re-usable workflow

* feat: set-up worflow on push with all actions

* fix: pass secrets correctly to other workflow

* fix: define required input type

* chore: changelog

* refactor: change to correct branch when merged
  • Loading branch information
lisabaut authored Oct 21, 2021
1 parent aef13ae commit 4a93e90
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 33 deletions.
51 changes: 21 additions & 30 deletions .github/workflows/android-actions.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
name: Android Build (Publish)
on: [push]
name: Android Build

on:
workflow_call:
inputs:
NVMRC:
required: true
type: string
secrets:
MAPBOX_ACCESS_TOKEN:
required: true

jobs:
test:
build_example:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: Checkout
uses: actions/checkout@v2

- name: Setup node ${{ inputs.NVMRC }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}

- run: yarn install --network-timeout 1000000
- run: yarn run unittest
- run: yarn run generate
node-version: ${{ inputs.NVMRC }}

- name: set up JDK zulu 11
- name: Setup JDK zulu 11
uses: actions/[email protected]
with:
distribution: "zulu"
java-version: "11"
distribution: 'zulu'
java-version: '11'

- run: echo $MAPBOX_ACCESS_TOKEN > ./accesstoken
working-directory: example
Expand All @@ -33,17 +38,3 @@ jobs:

- run: ./gradlew assemble
working-directory: example/android

publish:
needs: test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- uses: actions/[email protected]
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm install --force && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
15 changes: 12 additions & 3 deletions .github/workflows/ios-actions.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
name: iOS Build & Detox

on: [push]
on:
workflow_call:
inputs:
NVMRC:
required: true
type: string
secrets:
MAPBOX_ACCESS_TOKEN:
required: true

jobs:
build:
runs-on: macos-latest
timeout-minutes: 25

defaults:
run:
working-directory: ./example
Expand All @@ -19,10 +28,10 @@ jobs:
env:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}

- name: Install Node
- name: Setup node ${{ inputs.NVMRC }}
uses: actions/[email protected]
with:
node-version: "14"
node-version: ${{ inputs.NVMRC }}

- name: Install Yarn Dependencies
run: yarn install --network-timeout 1000000
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: On Push
on: [push]

jobs:
lint_test_generate:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- name: Setup node ${{ steps.nvm.outputs.NVMRC }}
uses: actions/[email protected]
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}

- name: Install
run: yarn install --network-timeout 1000000

- name: Lint
run: yarn run lint

- name: Test
run: yarn run unittest

- name: Generate
run: yarn run generate

outputs:
NVMRC: ${{ steps.nvm.outputs.NVMRC }}

call_android_workflow:
needs: lint_test_generate
uses: react-native-mapbox-gl/maps/.github/workflows/android-actions.yml@master
with:
NVMRC: ${{ needs.lint_test_generate.outputs.NVMRC }}
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}


call_ios_workflow:
needs: lint_test_generate
uses: react-native-mapbox-gl/maps/.github/workflows/ios-actions.yml@master
with:
NVMRC: ${{ needs.lint_test_generate.outputs.NVMRC }}
secrets:
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}

publish:
if: startsWith(github.ref, 'refs/tags/')
needs: [lint_test_generate, call_android_workflow, call_ios_workflow]
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup node ${{ steps.nvm.outputs.NVMRC }}
uses: actions/[email protected]
with:
node-version: ${{ needs.lint_test_generate.outputs.NVMRC }}
registry-url: https://registry.npmjs.org/

- name: Install and Publish
run: npm install --force && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ fix: revert pinned mapLibre version to `5.11.0` ([8a2b00e67ba6398f3f6e6f52e98b0f
build: upgrade to RN `0.66` ([#1570](https://github.com/react-native-mapbox-gl/maps/pull/1570))

style(eslint): align root and example with the same configuration ([#1575](https://github.com/react-native-mapbox-gl/maps/pull/1575))

chore(pre-commit): run lint on TS files, change PR template ([#1584](https://github.com/react-native-mapbox-gl/maps/pull/1584))
fix incorrect anchor calculation for PointAnnotation on iOS ([#1576](https://github.com/react-native-mapbox-gl/maps/pull/1576))

chore: improve GH workflows ([#1588](https://github.com/react-native-mapbox-gl/maps/pull/1588))

---

## 8.3.0
Expand Down

0 comments on commit 4a93e90

Please sign in to comment.