From 02be588cf1ca3db5e8d7296b6aae19681f2533cf Mon Sep 17 00:00:00 2001 From: Arthur Thompson Date: Tue, 9 Jan 2024 11:42:59 -0800 Subject: [PATCH] remove workflow --- .github/workflows/preview_deploy.yml | 75 -------------------------- .github/workflows/preview_generate.yml | 29 ---------- 2 files changed, 104 deletions(-) delete mode 100644 .github/workflows/preview_deploy.yml delete mode 100644 .github/workflows/preview_generate.yml diff --git a/.github/workflows/preview_deploy.yml b/.github/workflows/preview_deploy.yml deleted file mode 100644 index 379bb67e1..000000000 --- a/.github/workflows/preview_deploy.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Deploy Preview -on: - workflow_run: - workflows: ["Generate Preview"] - types: - - completed -permissions: read-all -jobs: - deploy: - runs-on: ubuntu-latest - if: > - ${{ github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' }} - steps: - - name: 'Download artifact' - uses: actions/github-script@v3.1.0 - with: - script: | - var artifacts = await github.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: ${{ github.event.workflow_run.id }}, - }); - var matchPrNumberArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name.match(/^pr_number_[0-9]{1,6}$/) - })[0]; - var downloadPrNumber = matchPreviewArtifact.name.substring(10); - var matchPreviewArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "preview" - })[0]; - var downloadPreview = await github.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchPreviewArtifact.id, - archive_format: 'zip', - }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/pr_number.txt', downloadPrNumber); - fs.writeFileSync('${{github.workspace}}/firestore-web.zip', Buffer.from(downloadPreview.data)); - - id: unzip - run: | - set -eou pipefail - pr_number=$(cat -e pr_number.txt) - pr_number=${pr_number%?} - pr_length=${#pr_number} - only_numbers_re="^[0-9]+$" - if ! [[ $pr_length <= 10 && $pr_number =~ $only_numbers_re ]] ; then - echo "invalid PR number" - exit 1 - fi - echo "::set-output name=pr_number::$pr_number" - mkdir firestore-web - unzip firestore-web.zip -d firestore-web - - name: Deploy preview - id: deploy_preview - uses: FirebaseExtended/action-hosting-deploy@v0 - with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_FIR_CODELABS_89252 }}' - projectId: fir-codelabs-89252 - entryPoint: firestore-web - channelId: firestore-web-${{ steps.unzip.outputs.pr_number }} - env: - FIREBASE_CLI_PREVIEWS: hostingchannels - - name: Write Comment - uses: actions/github-script@v3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - await github.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: ${{ steps.unzip.outputs.pr_number }}, - body: 'View preview ${{ steps.deploy_preview.outputs.details_url }}' - }); diff --git a/.github/workflows/preview_generate.yml b/.github/workflows/preview_generate.yml deleted file mode 100644 index cf2f49b37..000000000 --- a/.github/workflows/preview_generate.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Generate Preview -on: - pull_request: - paths: - - 'steps/**' -permissions: read-all -jobs: - build_and_preview: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Go environment - uses: actions/setup-go@v2.1.3 - - name: Generate preview - working-directory: ./steps - run: | - go install github.com/googlecodelabs/tools/claat@latest - $HOME/go/bin/claat export index.lab.md - - name: Save PR number - run: | - echo ${{ github.event.number }} > pr_number.txt - - uses: actions/upload-artifact@v2 - with: - name: preview - path: steps/firestore-web/ - - uses: actions/upload-artifact@v2 - with: - name: pr_number_${{ github.event.number }} - path: pr_number.txt