-
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 #13 from FifthTry/fixing-build-issue
fixes
- Loading branch information
Showing
1 changed file
with
13 additions
and
54 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 |
---|---|---|
|
@@ -3,69 +3,28 @@ name: Deploy Site | |
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '**.ftd' | ||
- '**.md' | ||
workflow_dispatch: | ||
env: | ||
CARGO_TERM_COLOR: always | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout main branch | ||
uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
- uses: FranzDiebold/github-env-vars-action@v2 | ||
- name: Install fastn | ||
id: install_fastn | ||
continue-on-error: false | ||
run: sh -c "$(curl -fsSL https://raw.githubusercontent.com/FifthTry/fastn/main/install-fastn.sh)" | ||
- run: sh -c "$(curl -fsSL https://fastn.io/install.sh)" | ||
- name: Build the pages with fastn | ||
id: build | ||
continue-on-error: false | ||
run: | | ||
echo "Using '$CI_REPOSITORY_NAME_SLUG/' as the base while building" | ||
# To deploy the website using GitHub Pages, use the below command | ||
fastn build --base=/$CI_REPOSITORY_NAME/ | ||
- uses: actions/upload-artifact@master | ||
# To deploy the website using Custom Domain, use the below command and comment | ||
#out the above command when deploying through GitHub Pages | ||
#fastn build --base=/ | ||
- name: copy CNAME if found | ||
run: '(test -f CNAME && cp CNAME .build) || echo "CNAME does not exist, skipping step"' | ||
- uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
name: GH_PAGES_BUILD | ||
path: .build/ | ||
deploy-gh-pages: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Prepare `gh-pages` branch creation | ||
id: clone_main | ||
uses: actions/checkout@v2 | ||
- name: Check if `gh-pages` branch exists | ||
id: branch_exists | ||
continue-on-error: true | ||
run: /usr/bin/git ls-remote --heads origin gh-pages | grep "" | ||
- name: Create branch if not exists | ||
id: create_branch | ||
if: steps.branch_exists.outcome != 'success' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "actions-user" | ||
git checkout --orphan gh-pages | ||
git reset --hard | ||
git commit --allow-empty -m "Initializing gh-pages branch" | ||
git push origin gh-pages | ||
- name: Checkout gh-pages branch | ||
uses: actions/checkout@v2 | ||
if: steps.branch_exists.outcome == 'success' | ||
with: | ||
ref: gh-pages | ||
- run: /bin/rm -rf * | ||
- uses: actions/download-artifact@master | ||
with: | ||
name: GH_PAGES_BUILD | ||
path: . | ||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
name: Commit changes to build branch | ||
with: | ||
commit_message: SSR build | ||
branch: gh-pages | ||
commit_options: '--no-verify --signoff' | ||
repository: . | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./.build |