From 6a2231b398033b81483b653b417736ee00d72042 Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Sat, 27 Jan 2024 19:01:28 +0530 Subject: [PATCH 1/4] chore: cleanup workflow --- .github/dependabot.yml | 10 ++++++++++ .github/workflows/deploy.yml | 27 ++++++++------------------- 2 files changed, 18 insertions(+), 19 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..58c14f3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + labels: + - "CI/CD" + commit-message: + prefix: ci diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ba806af..ab133c5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,33 +6,27 @@ on: - 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 + uses: actions/checkout@v4 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//${{ env.REPOSITORY_OWNER }}/g' -e 's//${{ env.REPOSITORY_NAME }}/g' FASTN.ftd - sed -i -e 's//${{ env.REPOSITORY_OWNER }}/g' -e 's//${{ env.REPOSITORY_NAME }}/g' FASTN/ds.ftd - sed -i -e 's//${{ env.REPOSITORY_OWNER }}/g' -e 's//${{ env.REPOSITORY_NAME }}/g' index.ftd - sed -i -e 's//${{ env.REPOSITORY_OWNER }}/g' -e 's//${{ env.REPOSITORY_NAME }}/g' sidebar.ftd - sed -i -e 's//${{ env.REPOSITORY_OWNER }}/g' -e 's//${{ env.REPOSITORY_NAME }}/g' README.md + sed -i -e "s//$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')/g" \ + -e "s//$(echo '${{ github.event.repository.name }}' | tr '[:upper:]' '[:lower:]')/g" \ + FASTN.ftd FASTN/ds.ftd index.ftd sidebar.ftd 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() }} @@ -40,19 +34,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - 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)" + - run: source <(curl -fsSL https://fastn.com/install.sh) - name: Build the pages with fastn 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/ - # 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"' - name: Deploy to GitHub Pages From f84039fd011a190e6435c2183174d4bd65f28d6a Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Sat, 27 Jan 2024 19:03:06 +0530 Subject: [PATCH 2/4] minor fixes --- .github/workflows/deploy.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ab133c5..b63dea0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -40,8 +40,12 @@ jobs: - run: source <(curl -fsSL https://fastn.com/install.sh) - name: Build the pages with fastn run: | + # To deploy the website using GitHub Pages, use the below command echo "Using '$CI_REPOSITORY_NAME_SLUG/' as the base while building" fastn build --base=/$CI_REPOSITORY_NAME/ + # 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"' - name: Deploy to GitHub Pages From 04c5ad4ff747d1b238b52da9cf942a9b5d959b6c Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Sat, 27 Jan 2024 19:04:17 +0530 Subject: [PATCH 3/4] fixed comments --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b63dea0..7ab131c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -40,8 +40,8 @@ jobs: - run: source <(curl -fsSL https://fastn.com/install.sh) - name: Build the pages with fastn run: | - # To deploy the website using GitHub Pages, use the below command 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/ # To deploy the website using Custom Domain, use the below command and comment #out the above command when deploying through GitHub Pages From c1dd624e3895514d1740dc1cf29d9cb5e68cfa38 Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Sat, 27 Jan 2024 19:07:39 +0530 Subject: [PATCH 4/4] minor changes --- .github/workflows/deploy.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7ab131c..e4c7c92 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,9 +18,8 @@ jobs: ref: ${{ github.head_ref }} - name: Rename the project run: | - sed -i -e "s//$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')/g" \ - -e "s//$(echo '${{ github.event.repository.name }}' | tr '[:upper:]' '[:lower:]')/g" \ - FASTN.ftd FASTN/ds.ftd index.ftd sidebar.ftd README.md + # Replace placeholders in project files with actual repository owner and name + sed -i -e 's//${{ github.repository_owner }}/g' -e 's//${{ github.event.repository.name }}/g' FASTN.ftd FASTN/ds.ftd index.ftd sidebar.ftd README.md - name: Commit and push changes uses: stefanzweifel/git-auto-commit-action@v4 with: