name: Roleypoly CI on: push: pull_request: jobs: node_test: runs-on: ubuntu-latest name: Node CI steps: - uses: actions/checkout@master - uses: actions/setup-node@v2.5.1 with: node-version: '20' cache: yarn - run: yarn install --frozen-lockfile - run: yarn lint # - run: yarn test worker_build: runs-on: ubuntu-latest name: Worker Build & Publish if: startsWith(github.ref, 'refs/heads/dependabot/') != true needs: - node_test strategy: matrix: worker: - api steps: - uses: actions/checkout@master - uses: actions/setup-node@v2.5.1 with: node-version: '20' cache: yarn - id: 'auth' uses: 'google-github-actions/auth@v0' with: credentials_json: '${{ secrets.GCS_TF_KEY }}' - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@v0 with: project_id: ${{ secrets.GCS_PROJECT_ID }} export_default_credentials: true - name: Check if already deployed id: check run: | gsutil stat gs://roleypoly-artifacts/workers/${{ github.sha }}/index.mjs \ && echo ::set-output name=skip::1 \ || echo ::set-output name=skip::0 - run: yarn install --frozen-lockfile if: steps.check.outputs.skip == '0' - run: | yarn build:api if: steps.check.outputs.skip == '0' - id: upload-file if: github.event_name == 'push' && steps.check.outputs.skip == '0' uses: google-github-actions/upload-cloud-storage@main with: path: packages/api/dist/index.mjs destination: roleypoly-artifacts/workers/${{ github.sha }} trigger_deploy: name: Deploy to Stage needs: - worker_build if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Invoke Deploy workflow uses: benc-uk/workflow-dispatch@v1 with: workflow: Deploy token: ${{ secrets.GITOPS_TOKEN }} inputs: |- { "environment": "stage", "worker_tag": "${{ github.sha }}" }