Merge pull request #1835 from starknet-io/enhancement/sitemap #4294
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
name: Build and Deploy Netlify CMS | |
on: | |
push: | |
jobs: | |
build-and-deploy: | |
name: Build and Deploy | |
environment: | |
name: Netlify CMS ${{ github.ref_name }} | |
url: https://${{ env.GITHUB_REF_SLUG_URL }}.starknet-netlify-cms-byd.pages.dev | |
permissions: | |
contents: read | |
deployments: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: yarn | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.yarn/cache | |
.yarn/install-state.gz | |
.eslintcache | |
**/tsconfig.tsbuildinfo | |
**/.types/** | |
**/.types-*/** | |
key: build-cache-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
build-cache- | |
- name: Install dependencies | |
run: yarn | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
with: | |
slug-maxlength: 28 | |
- name: Set URLS | |
run: | | |
if [ "${{ env.GITHUB_REF_SLUG_URL }}" = "production" ]; then | |
echo "VITE_LIVE_PREVIEW_URL=https://www.starknet.io" >> $GITHUB_ENV | |
echo "VITE_API_BASE_URL=https://www.starknet.io/api" >> $GITHUB_ENV | |
echo "VITE_DATA_URL=https://www.starknet.io/data" >> $GITHUB_ENV | |
else | |
echo "VITE_LIVE_PREVIEW_URL=https://${{ env.GITHUB_REF_SLUG_URL }}.starknet-websites.pages.dev" >> $GITHUB_ENV | |
echo "VITE_API_BASE_URL=https://${{ env.GITHUB_REF_SLUG_URL }}.starknet-websites.pages.dev/api" >> $GITHUB_ENV | |
echo "VITE_DATA_URL=https://${{ env.GITHUB_REF_SLUG_URL }}.starknet-websites.pages.dev/data" >> $GITHUB_ENV | |
fi | |
- name: Build Netlify CMS | |
run: yarn workspace @starknet-io/netlify-cms build | |
env: | |
VITE_GIT_BRANCH_NAME: ${{ github.ref_name }} | |
VITE_BACKEND_AUTH_URL: https://netlify-cms-auth.haim-6b2.workers.dev | |
- name: Deploy Netlify CMS | |
uses: cloudflare/pages-action@1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: starknet-netlify-cms | |
directory: workspaces/netlify-cms/dist | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref_name == 'production' && 'main' || github.ref_name }} |