mirror of
https://github.com/PrivSec-dev/privsec.dev
synced 2024-12-23 13:21:34 -05:00
Safer Workflow
Signed-off-by: Tommy <contact@tommytran.io>
This commit is contained in:
parent
7792fac777
commit
7a8051d41f
@ -1,30 +1,42 @@
|
|||||||
# This file was auto-generated by the Firebase CLI
|
|
||||||
# https://github.com/firebase/firebase-tools
|
|
||||||
|
|
||||||
name: Deploy to Firebase Hosting on PR
|
name: Deploy to Firebase Hosting on PR
|
||||||
'on': pull_request_target
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Build Hugo site on PR"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build_and_Preview:
|
Preview:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: >
|
||||||
|
${{ github.event.workflow_run.event == 'pull_request' &&
|
||||||
|
github.event.workflow_run.conclusion == 'success' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Download artifact
|
||||||
uses: actions/checkout@v2
|
uses: actions/github-script@v3.1.0
|
||||||
with:
|
with:
|
||||||
submodules: true # Fetch Hugo themes (true OR recursive)
|
script: |
|
||||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
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: Fecth External Blog
|
- name: Unzip artifact
|
||||||
# run: ./external-blogs.sh
|
run: unzip public.zip
|
||||||
|
|
||||||
- name: Hugo setup
|
- name: Deploy to Firebase
|
||||||
uses: peaceiris/actions-hugo@v2
|
|
||||||
with:
|
|
||||||
hugo-version: 'latest'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: hugo --minify
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
uses: FirebaseExtended/action-hosting-deploy@v0
|
uses: FirebaseExtended/action-hosting-deploy@v0
|
||||||
with:
|
with:
|
||||||
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
|
31
.github/workflows/pull-request-reciever.yml
vendored
Normal file
31
.github/workflows/pull-request-reciever.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# This file was auto-generated by the Firebase CLI
|
||||||
|
# https://github.com/firebase/firebase-tools
|
||||||
|
|
||||||
|
name: Build Hugo site on PR
|
||||||
|
'on': pull_request
|
||||||
|
jobs:
|
||||||
|
Build_Hugo_Site:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true # Fetch Hugo themes (true OR recursive)
|
||||||
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||||
|
|
||||||
|
#- name: Fecth External Blog
|
||||||
|
# run: ./external-blogs.sh
|
||||||
|
|
||||||
|
- name: Hugo setup
|
||||||
|
uses: peaceiris/actions-hugo@v2
|
||||||
|
with:
|
||||||
|
hugo-version: 'latest'
|
||||||
|
|
||||||
|
- name: Build Hugo site
|
||||||
|
run: hugo --minify
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: public
|
||||||
|
path: public/
|
Loading…
Reference in New Issue
Block a user