ci: Remove docs preview jobs
It uses unmaintained CI actions and is easy to replace locally.
This commit is contained in:
		
							parent
							
								
									8881755235
								
							
						
					
					
						commit
						770dce844e
					
				
							
								
								
									
										59
									
								
								.github/workflows/docs-preview.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										59
									
								
								.github/workflows/docs-preview.yml
									
									
									
									
										vendored
									
									
								
							| @ -1,59 +0,0 @@ | ||||
| name: Docs Preview | ||||
| 
 | ||||
| on: | ||||
|   workflow_run: | ||||
|     workflows: [CI] | ||||
|     types: | ||||
|       - completed | ||||
| 
 | ||||
| jobs: | ||||
|   deploy: | ||||
|     runs-on: ubuntu-latest | ||||
|     if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.pull_requests[0] != null | ||||
|     steps: | ||||
|       - name: Download artifact | ||||
|         uses: actions/github-script@v7 | ||||
|         with: | ||||
|           script: | | ||||
|             let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||||
|                 owner: context.repo.owner, | ||||
|                 repo: context.repo.repo, | ||||
|                 run_id: context.payload.workflow_run.id, | ||||
|             }); | ||||
|             let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | ||||
|               return artifact.name == "docs"; | ||||
|             })[0]; | ||||
|             let download = await github.rest.actions.downloadArtifact({ | ||||
|                 owner: context.repo.owner, | ||||
|                 repo: context.repo.repo, | ||||
|                 artifact_id: matchArtifact.id, | ||||
|                 archive_format: 'zip', | ||||
|             }); | ||||
|             let fs = require('fs'); | ||||
|             fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/docs.zip`, Buffer.from(download.data)); | ||||
| 
 | ||||
|       - name: Unzip artifact | ||||
|         run: | | ||||
|           unzip docs.zip | ||||
|           tar -xf docs.tar.zstd | ||||
| 
 | ||||
|       - name: Deploy PR preview | ||||
|         continue-on-error: true | ||||
|         id: deploy_preview | ||||
|         uses: dswistowski/surge-sh-action@v.1.0.3 | ||||
|         with: | ||||
|           domain: pr-${{ github.event.workflow_run.pull_requests[0].number }}--ruma-docs.surge.sh | ||||
|           project: doc | ||||
|           login: ${{ secrets.SURGE_LOGIN }} | ||||
|           token: ${{ secrets.SURGE_TOKEN }} | ||||
| 
 | ||||
|       - name: Comment PR preview URL | ||||
|         if: steps.deploy_preview.outcome == 'success' | ||||
|         uses: Beakyn/gha-comment-pull-request@v1.0.2 | ||||
|         env: | ||||
|           GITHUB_TOKEN: ${{ github.token }} | ||||
|         with: | ||||
|           pull-request-number: ${{ github.event.workflow_run.pull_requests[0].number }} | ||||
|           description-message: | | ||||
|             ---- | ||||
|             Preview: https://pr-${{ github.event.workflow_run.pull_requests[0].number }}--ruma-docs.surge.sh | ||||
							
								
								
									
										54
									
								
								.github/workflows/docs-remove-preview.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										54
									
								
								.github/workflows/docs-remove-preview.yml
									
									
									
									
										vendored
									
									
								
							| @ -1,54 +0,0 @@ | ||||
| name: Docs Remove Preview | ||||
| 
 | ||||
| on: | ||||
|   workflow_run: | ||||
|     workflows: [PR Closed] | ||||
|     types: | ||||
|       - completed | ||||
| 
 | ||||
| jobs: | ||||
|   teardown: | ||||
|     runs-on: ubuntu-latest | ||||
|     if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' | ||||
|     steps: | ||||
|       - name: Get PR number | ||||
|         uses: actions/github-script@v7 | ||||
|         id: get_pr | ||||
|         continue-on-error: true | ||||
|         with: | ||||
|           script: | | ||||
|             let login = context.payload.workflow_run.head_repository.owner.login; | ||||
|             let branch = context.payload.workflow_run.head_branch; | ||||
|             let head = `${login}:${branch}`; | ||||
|             let prs = await github.rest.pulls.list({ | ||||
|               owner: context.repo.owner, | ||||
|               repo: context.repo.repo, | ||||
|               state: "closed", | ||||
|               head, | ||||
|             }); | ||||
|             if (prs.data.length > 0) { | ||||
|               core.setOutput("prnumber", prs.data[0].number); | ||||
|             } else { | ||||
|               core.setFailed("Could not find PR"); | ||||
|             } | ||||
| 
 | ||||
|       - name: Teardown preview | ||||
|         if: steps.get_pr.outcome == 'success' | ||||
|         continue-on-error: true | ||||
|         uses: adrianjost/actions-surge.sh-teardown@v1.0.3 | ||||
|         with: | ||||
|           regex: pr-${{ steps.get_pr.outputs.prnumber }}--ruma-docs.surge.sh | ||||
|         env: | ||||
|           SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | ||||
|           SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | ||||
| 
 | ||||
|       - name: Remove PR preview URL | ||||
|         if: steps.get_pr.outcome == 'success' | ||||
|         uses: Beakyn/gha-comment-pull-request@v1.0.2 | ||||
|         env: | ||||
|           GITHUB_TOKEN: ${{ github.token }} | ||||
|         with: | ||||
|           pull-request-number: ${{ steps.get_pr.outputs.prnumber }} | ||||
|           description-message: | | ||||
|             ---- | ||||
|             Preview Removed | ||||
							
								
								
									
										13
									
								
								.github/workflows/pr-closed.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								.github/workflows/pr-closed.yml
									
									
									
									
										vendored
									
									
								
							| @ -1,13 +0,0 @@ | ||||
| name: PR Closed | ||||
| 
 | ||||
| on: | ||||
|   pull_request: | ||||
|     branches: [main, next] | ||||
|     types: [closed] | ||||
| 
 | ||||
| jobs: | ||||
|   docs: | ||||
|     name: Trigger | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - run: 'echo "PR number: ${{ github.event.number }}"' | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user