Skip to content

Merge pull request #1401 from OneSignal/fg/size-reduction-4 #134

Merge pull request #1401 from OneSignal/fg/size-reduction-4

Merge pull request #1401 from OneSignal/fg/size-reduction-4 #134

Workflow file for this run

name: Build SDK Files & GCS Upload
on:
push:
branches:
- main
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
check_release:
runs-on: ubuntu-22.04
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- name: Check if release merge or workflow dispatch
id: check
uses: actions/github-script@v8
with:
script: |
const shouldRun = context.eventName === 'workflow_dispatch' ||
/Release \d{6}/.test(context.payload.head_commit.message);
core.setOutput('should_run', shouldRun);
test_build_deploy:
runs-on: ubuntu-22.04
needs: check_release
if: needs.check_release.outputs.should_run == 'true'
steps:
- uses: actions/checkout@v5
- name: Use Node.js
uses: actions/setup-node@v5
with:
node-version-file: '.nvmrc'
- name: 'Install dependencies'
run: npm ci
- name: 'Build for Staging'
run: npm run build:staging
- name: 'Build for Production'
run: npm run build:prod
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
- name: 'Upload SDK Files to GCS'
uses: 'google-github-actions/upload-cloud-storage@v1'
with:
path: 'build/releases'
destination: 'sdk-builds-persistence-onesignal/web-sdk/${{ github.sha }}'
parent: false
- name: 'Get SDK Version'
id: get_version
run: echo "SDK_VERSION=$(node -p "require('./package.json').config.sdkVersion")" >> $GITHUB_OUTPUT
- name: 'Create turbine pr'
run: ./build/scripts/turbine.sh
env:
GH_TURBINE_TOKEN: ${{ secrets.GH_TURBINE_TOKEN }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_RUN_ID: ${{ github.run_id }}
SDK_VERSION: ${{ steps.get_version.outputs.SDK_VERSION }}
create_release:
needs: test_build_deploy
uses: ./.github/workflows/create-release-on-github.yml