Skip to content

Commit

Permalink
Update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
RUTUKAPATE authored Feb 1, 2024
1 parent e29add5 commit c43dc66
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,48 @@
name: Deploy Site
name: Rename and Deploy Site

on:
push:
branches: [ main ]
workflow_dispatch:
workflow_call:
branches:
- main

jobs:
rename-project:
if: ${{ github.repository != 'fastn-stack/fastn-template' && github.event.created }}
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set repository name and owner
run: |
echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "REPOSITORY_OWNER=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
shell: bash
- name: Rename the project
run: |
echo "Using '${{ env.REPOSITORY_NAME }}' and "${{ env.REPOSITORY_OWNER }}" to rename fastn package"
sed -i -e 's/<user_name>/${{ env.REPOSITORY_OWNER }}/g' -e 's/<repo_name>/${{ env.REPOSITORY_NAME }}/g' FASTN.ftd
sed -i -e 's/<user_name>/${{ env.REPOSITORY_OWNER }}/g' -e 's/<repo_name>/${{ env.REPOSITORY_NAME }}/g' FASTN/ds.ftd
sed -i -e 's/<user_name>/${{ env.REPOSITORY_OWNER }}/g' -e 's/<repo_name>/${{ env.REPOSITORY_NAME }}/g' index.ftd
sed -i -e 's/<user_name>/${{ env.REPOSITORY_OWNER }}/g' -e 's/<repo_name>/${{ env.REPOSITORY_NAME }}/g' sidebar.ftd
sed -i -e 's/<user_name>/${{ env.REPOSITORY_OWNER }}/g' -e 's/<repo_name>/${{ env.REPOSITORY_NAME }}/g' README.md
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "✅ Ready to clone and code."
push_options: --force
build:
needs: rename-project
if: ${{ github.repository != 'fastn-stack/fastn-template' && always() && !failure() && !cancelled() }}
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
- name: Pull the latest commits
run: git pull
- uses: FranzDiebold/github-env-vars-action@v2
- run: sh -c "$(curl -fsSL https://fastn.com/install.sh)"
- name: Build the pages with fastn
Expand All @@ -24,7 +55,8 @@ jobs:
#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
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.build

0 comments on commit c43dc66

Please sign in to comment.