ci: drop missing .nvmrc reference from CD and release workflows (#1466) #196
This file contains hidden or 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: Build, Deploy & Create GitHub Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**.md' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: read # Required by called github-release.yml | |
| jobs: | |
| check_release: | |
| runs-on: ubuntu-latest | |
| 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); | |
| build_deploy: | |
| name: Build & Deploy | |
| runs-on: ubuntu-latest | |
| needs: check_release | |
| if: needs.check_release.outputs.should_run == 'true' | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Vite+ | |
| uses: voidzero-dev/setup-vp@v1 | |
| with: | |
| cache: true | |
| - name: Build for Staging | |
| run: vp run build:staging | |
| - name: Build for Production | |
| run: vp 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 version | |
| id: get_version | |
| run: | | |
| SDK_VERSION=$(node -p "require('./package.json').config.sdkVersion") | |
| if git rev-parse "$SDK_VERSION" >/dev/null 2>&1; then | |
| echo "Tag $SDK_VERSION already exists, skipping release" | |
| else | |
| echo "version=$SDK_VERSION" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create turbine PR | |
| if: steps.get_version.outputs.version != '' | |
| run: ./build/scripts/turbine.sh | |
| env: | |
| GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }} | |
| GITHUB_SHA: ${{ github.sha }} | |
| GITHUB_RUN_ID: ${{ github.run_id }} | |
| SDK_VERSION: ${{ steps.get_version.outputs.version }} | |
| create_github_release: | |
| needs: build_deploy | |
| if: needs.build_deploy.outputs.version != '' | |
| uses: OneSignal/sdk-shared/.github/workflows/github-release.yml@main | |
| secrets: | |
| GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }} | |
| with: | |
| version: ${{ needs.build_deploy.outputs.version }} |