mirror of
https://github.com/PrivSec-dev/privsec.dev
synced 2024-12-23 13:21:34 -05:00
44 lines
1.5 KiB
YAML
44 lines
1.5 KiB
YAML
name: Deploy to Firebase Hosting on PR
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Build Hugo site on PR"]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
Preview:
|
|
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 matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
|
return artifact.name == "public"
|
|
})[0];
|
|
var download = await github.actions.downloadArtifact({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
artifact_id: matchArtifact.id,
|
|
archive_format: 'zip',
|
|
});
|
|
var fs = require('fs');
|
|
fs.writeFileSync('${{github.workspace}}/public.zip', Buffer.from(download.data));
|
|
|
|
- name: Unzip artifact
|
|
run: unzip public.zip
|
|
|
|
- name: Deploy to Firebase
|
|
uses: FirebaseExtended/action-hosting-deploy@v0
|
|
with:
|
|
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
|
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PRIVSEC_356523 }}'
|
|
projectId: privsec-356523 |