deployment staging - rename path #8
Workflow file for this run
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: Deploy staging | |
# Controls when the action will run. Triggers the workflow on push | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ develop ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest # The type of runner that the job will run on | |
steps: # Steps represent a sequence of tasks that will be executed as part of the job | |
- uses: actions/checkout@v2 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Enter data to .env file | |
run: | | |
echo FLOTIQ_BASE_URL=https://api.flotiq.com >> .env.production | |
echo FLOTIQ_API_KEY="$FLOTIQ_API_KEY" >> .env.production | |
echo SCOPED_FLOTIQ_API_KEY="$SCOPED_FLOTIQ_API_KEY" >> .env.production | |
echo GA_MEASUREMENT_ID="$GA_MEASUREMENT_ID" >> .env.production | |
shell: bash | |
env: | |
FLOTIQ_API_KEY: ${{ secrets.FLOTIQ_API_KEY }} | |
SCOPED_FLOTIQ_API_KEY: ${{ secrets.SCOPED_FLOTIQ_API_KEY }} | |
GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }} | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '14' | |
- run: yarn install | |
- name: Gatsby | |
run: | | |
npm install -g [email protected] | |
gatsby clean | |
gatsby build --prefix-paths | |
rm -rf public/staging-blog | |
mkdir -p public/staging-blog | |
find public/ -maxdepth 1 -mindepth 1 -not -name staging-blog -exec mv '{}' public/staging-blog/ \; | |
- name: Cloudflare | |
run: | | |
npm install -g @cloudflare/wrangler | |
wrangler init --site flotiq-staging-blog | |
sed -i 's+account_id = '\'\''+account_id = '"'"$ACCOUNT_ID"'"'+g' wrangler.toml | |
sed -i 's+bucket = ""+bucket = "public"+g' wrangler.toml | |
sed -i 's+zone_id = '\'\''+zone_id = '"'"$ZONE_ID"'"'+g' wrangler.toml | |
sed -i 's+workers_dev = true++g' wrangler.toml | |
echo "[env.production]" >> wrangler.toml | |
echo "route = 'flotiq.com/staging-blog/*'" >> wrangler.toml | |
echo 'zone_id = '"'"$ZONE_ID"'" >> wrangler.toml | |
mkdir -p /home/runner/.wrangler/config/ | |
echo api_token = '"'"$API_TOKEN"'"' > /home/runner/.wrangler/config/default.toml | |
cat wrangler.toml | |
cp worker-index.js workers-site/index.js | |
wrangler publish --env=production | |
# Refresh sitemap in Google and Bing | |
curl "https://www.google.com/webmasters/sitemaps/ping?sitemap=https://flotiq.com/staging-blog/sitemap/sitemap-index.xml" | |
curl "https://www.bing.com/webmaster/ping.aspx?siteMap=https://flotiq.com/staging-blog/sitemap/sitemap-index.xml" | |
shell: bash | |
env: | |
API_TOKEN: ${{ secrets.API_TOKEN }} | |
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} | |
ZONE_ID: ${{ secrets.ZONE_ID }} |