Skip to content

Commit

Permalink
Use modular ci (#83)
Browse files Browse the repository at this point in the history
* add define_shared_variables

* Update define-shared-variables.yml

* Update define-shared-variables.yml

* Update define-shared-variables.yml

* Update define-shared-variables.yml

* Create install-dependencies.yml

* use env variables to restore cache in base build

* Update base-build.yml

* Use shared variables in deploy-to-firebase.yml

* Use centralized NODE_VERSION

* Update define-shared-variables.yml

* Update build.yml

* Update define-shared-variables.yml

* Define head/base related variables from calling workflow

* Update build.yml

* Update define-shared-variables.yml

* Update pr.yml

* Update pr.yml

* fix

* Update pr.yml

* fix

* Update pr.yml

* Update pr.yml

* Update define-shared-variables.yml

* Update pr.yml

* Update define-shared-variables.yml

* Update pr.yml

* Update pr.yml

* Update pr.yml

* change build.yml
  • Loading branch information
skynetigor authored Jul 8, 2023
1 parent 668fe54 commit 28abc09
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,29 @@ concurrency:

jobs:
define_shared_variables:
runs-on: ubuntu-latest
env:
NODE_VERSION: 16.15.1

steps:
- name: Export variables to JSON
id: varsStep
uses: actions/github-script@v6
with:
script: core.setOutput('value', ${{ toJson(env) }})

outputs:
vars: ${{ steps.varsStep.outputs.value }}

share_variables:
uses: ./.github/workflows/define-shared-variables.yml
needs: define_shared_variables
with:
shared-variables: ${{ needs.define_shared_variables.outputs.vars }}

install_dependencies:
uses: ./.github/workflows/install-dependencies.yml
needs: define_shared_variables
needs: share_variables

build_lib:
uses: ./.github/workflows/base-build.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/define-shared-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
uses: actions/github-script@v6
with:
script: |
const sharedVariablesObject = '${{ inputs.shared-variables }}' || {};
const envVarsFromInputs = `${{ inputs.shared-variables }}`;
const sharedVariablesObject = envVarsFromInputs ? JSON.parse(envVarsFromInputs) : {};
function exportVariable(name, value) {
sharedVariablesObject[name] = value;
Expand Down Expand Up @@ -58,7 +59,6 @@ jobs:
id: sharedVarsStep
uses: actions/github-script@v6
env:
NODE_VERSION: 16.15.1
DEPENDENCIES_CACHE_KEY: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }}
DEPENDENCIES_RESTORE_KEY: ''

Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,29 @@ concurrency:

jobs:
define_shared_variables:
runs-on: ubuntu-latest
env:
NODE_VERSION: 16.15.1

steps:
- name: Export variables to JSON
id: varsStep
uses: actions/github-script@v6
with:
script: core.setOutput('value', ${{ toJson(env) }})

outputs:
vars: ${{ steps.varsStep.outputs.value }}

share_variables:
uses: ./.github/workflows/define-shared-variables.yml
needs: define_shared_variables
with:
shared-variables: ${{ needs.define_shared_variables.outputs.vars }}

install_dependencies:
uses: ./.github/workflows/install-dependencies.yml
needs: define_shared_variables
needs: share_variables

build_lib:
uses: ./.github/workflows/base-build.yml
Expand Down

0 comments on commit 28abc09

Please sign in to comment.