Update ci.yml #135
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
name: Cosmo Previews | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- reopened | |
- closed | |
- synchronize | |
jobs: | |
create: | |
runs-on: ubuntu-latest | |
if: github.event.action == 'opened' || github.event.action == 'reopened' | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.0 | |
cache: npm | |
- name: Install wgc | |
run: npm i -g wgc@latest | |
# 1. Create & Publish feature subgraph based on cosmo.yaml | |
# 2. Create a new feature flag | |
- uses: ./ | |
id: ff | |
with: | |
config_path: .github/cosmo.yaml | |
create: true # Create the feature flag + subgraphs from cosmo.yaml | |
cosmo_api_key: ${{ secrets.COSMO_API_KEY }} | |
github_token: ${{ secrets. GITHUB_TOKEN }} | |
- run: | | |
echo "${{ steps.ff.outputs.feature_subgraphs_to_deploy }}" | |
# run the job to deploy all the changed subgraphs here. | |
update: | |
runs-on: ubuntu-latest | |
if: github.event.action == 'synchronize' | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.0 | |
cache: npm | |
- name: Install wgc | |
run: npm i -g wgc@latest | |
- uses: ./ | |
id: ff | |
with: | |
config_path: .github/cosmo.yaml | |
update: true # Only update the feature subgraphs from cosmo.yaml | |
cosmo_api_key: ${{ secrets.COSMO_API_KEY }} | |
github_token: ${{ secrets. GITHUB_TOKEN }} | |
- run: | | |
echo "${{ steps.ff.outputs.feature_subgraphs_to_deploy }}" | |
echo "${{ steps.ff.outputs.feature_subgraphs_to_destroy }}" | |
# run the job to deploy all the changed subgraphs here. | |
destroy: | |
runs-on: ubuntu-latest | |
if: github.event.action == 'closed' | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .node-version | |
cache: npm | |
- name: Install wgc | |
run: npm i -g wgc@latest | |
- uses: ./ | |
id: ff | |
with: | |
config_path: .github/cosmo.yaml | |
destroy: true # Only destroy the feature flag + subgraphs from cosmo.yaml | |
cosmo_api_key: ${{ secrets.COSMO_API_KEY }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
echo "Feature flag and the feature subgraphs have been destroyed. You can now unprovision the subgraph services." | |
- run: | | |
echo "${{ steps.ff.outputs.feature_subgraphs_to_destroy }}" |