-
-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(actions): run forks with access tokens from protected envs (#3217)
- Loading branch information
Showing
4 changed files
with
78 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,13 @@ name: Android Build | |
on: | ||
workflow_call: | ||
inputs: | ||
env_name: | ||
required: true | ||
default: default | ||
type: string | ||
ref: | ||
required: false | ||
type: string | ||
NVMRC: | ||
required: true | ||
type: string | ||
|
@@ -11,10 +18,6 @@ on: | |
default: mapbox | ||
required: false | ||
type: string | ||
REF_FORK: | ||
description: "If build from fork repo or not" | ||
required: false | ||
type: string | ||
NEW_ARCH: | ||
description: "If build with new architecture or not" | ||
default: false | ||
|
@@ -25,21 +28,26 @@ on: | |
required: true | ||
MAPBOX_DOWNLOAD_TOKEN: | ||
required: true | ||
ENV_MAPBOX_ACCESS_TOKEN: | ||
required: false | ||
ENV_MAPBOX_DOWNLOAD_TOKEN: | ||
required: false | ||
|
||
jobs: | ||
build_example: | ||
name: Android Example Build ${{ inputs.NEW_ARCH && 'Fabric' || 'Paper' }} ${{ inputs.MAP_IMPL }} | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.env_name }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
if: ${{ github.event.inputs.REF_FORK == false }} | ||
if: ${{ inputs.ref == '' }} | ||
|
||
- name: Checkout fork | ||
uses: actions/checkout@v4 | ||
if: ${{ github.event.inputs.REF_FORK == true }} | ||
if: ${{ inputs.ref != '' }} | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Setup node ${{ inputs.NVMRC }} | ||
uses: actions/[email protected] | ||
|
@@ -57,12 +65,12 @@ jobs: | |
echo MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOAD_TOKEN > ~/.gradle/gradle.properties | ||
working-directory: example | ||
env: | ||
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }} | ||
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN || secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }} | ||
- run: echo $MAPBOX_ACCESS_TOKEN > ./accesstoken | ||
working-directory: example | ||
env: | ||
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }} | ||
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN || secrets.ENV_MAPBOX_ACCESS_TOKEN }} | ||
|
||
- run: yarn install --network-timeout 1000000 | ||
working-directory: example | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,13 @@ name: iOS Build & Detox | |
on: | ||
workflow_call: | ||
inputs: | ||
env_name: | ||
required: true | ||
default: default | ||
type: string | ||
ref: | ||
required: false | ||
type: string | ||
NVMRC: | ||
required: true | ||
type: string | ||
|
@@ -21,12 +28,17 @@ on: | |
required: true | ||
MAPBOX_DOWNLOAD_TOKEN: | ||
required: true | ||
ENV_MAPBOX_ACCESS_TOKEN: | ||
required: false | ||
ENV_MAPBOX_DOWNLOAD_TOKEN: | ||
required: false | ||
|
||
jobs: | ||
build: | ||
name: iOS Example Build ${{ inputs.NEW_ARCH && 'Fabric' || 'Paper' }} ${{ inputs.MAP_IMPL }} | ||
runs-on: macos-12 | ||
timeout-minutes: 55 | ||
environment: ${{ inputs.env_name }} | ||
|
||
defaults: | ||
run: | ||
|
@@ -35,11 +47,18 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
if: ${{ inputs.ref == '' }} | ||
|
||
- name: Checkout fork | ||
uses: actions/checkout@v4 | ||
if: ${{ inputs.ref != '' }} | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Access Token | ||
run: echo $MAPBOX_ACCESS_TOKEN > ./accesstoken | ||
env: | ||
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }} | ||
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN || secrets.ENV_MAPBOX_ACCESS_TOKEN }} | ||
|
||
- name: Setup .netrc with MAPBOX_DOWNLOAD_TOKEN | ||
run: | | ||
|
@@ -49,7 +68,7 @@ jobs: | |
chmod 0600 ~/.netrc | ||
if: "${{ env.MAPBOX_DOWNLOAD_TOKEN != '' }}" | ||
env: | ||
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN }} | ||
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_DOWNLOAD_TOKEN || secrets.ENV_MAPBOX_DOWNLOAD_TOKEN }} | ||
|
||
- name: Setup node ${{ inputs.NVMRC }} | ||
uses: actions/[email protected] | ||
|