forked from layer5io/sistent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request layer5io#225 from coder12git/deploy
GitHub workflows for deployment preview
- Loading branch information
Showing
3 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build and Deploy Site | ||
on: | ||
push: | ||
branches: [ master ] | ||
paths: | ||
- '!**' | ||
- 'site/**' | ||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@master | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install and Build 🔧 | ||
run: | | ||
cd site | ||
npm install | ||
npm run build | ||
- name: Deploy 🚀 | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: site # The branch the action should deploy to. | ||
folder: public # The folder the action should deploy. | ||
clean: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build and Preview Site | ||
on: | ||
pull_request: | ||
branches: [ master ] | ||
types: [opened, synchronize, reopened] | ||
paths: | ||
- '!**' | ||
- 'site/**' | ||
|
||
jobs: | ||
site-preview: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@master | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 1 | ||
|
||
- name: Install and Build 🔧 | ||
run: | | ||
cd site | ||
npm install | ||
npm run noIndex | ||
- name: Zip Site | ||
run: bash site/script.sh | ||
- name: Upload files | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: public-dir | ||
path: ./public-dir.zip | ||
retention-days: 1 | ||
- name: Triger Inner workflow | ||
run: echo "trigering inner workflow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Deploy Preview | ||
on: | ||
workflow_run: | ||
workflows: | ||
- Build and Preview Site | ||
types: | ||
- completed | ||
|
||
jobs: | ||
deploy-preview: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
- name: Download Site dir | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
github_token: ${{ secrets.GH_ACCESS_TOKEN }} | ||
workflow: build-and-preview-site.yml | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: public-dir | ||
|
||
- name: Unzip Site | ||
run: | | ||
rm -rf ./site/public | ||
unzip public-dir.zip | ||
rm -f public-dir.zip | ||
- name: Deploy to Netlify | ||
id: netlify | ||
uses: nwtgck/[email protected] | ||
with: | ||
publish-dir: 'site/public' | ||
production-deploy: false | ||
github-token: ${{ secrets.GH_ACCESS_TOKEN }} | ||
enable-commit-comment: false | ||
env: | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
|
||
- name: Comment Deploy URL | ||
uses: ./.github/actions/comment-preview-on-pr | ||
with: | ||
token: ${{ secrets.GH_ACCESS_TOKEN }} | ||
deploy_url: "${{ steps.netlify.outputs.deploy-url }}" |