Updated Image (#524) #400
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: "Staging CD" | |
on: | |
push: | |
branches: | |
- "dev" | |
jobs: | |
StagingDeploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update package information with default mirror | |
run: sudo sed -i 's|mirror+file:/etc/apt/apt-mirrors.txt|http://archive.ubuntu.com/ubuntu|' /etc/apt/sources.list && sudo apt-get update | |
- name: Install libvips | |
run: sudo apt-get install libvips | |
- uses: actions/checkout@v2 | |
- name: Setup Node 18 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: | | |
rm -rf .cache node_modules | |
npm i --force --unsafe-perm | |
- name: Force installing sharp | |
run: npm install --ignore-scripts=false --verbose [email protected] --unsafe-perm --force | |
- name: "Create env file" | |
run: | | |
rm -rf .env | |
touch .env | |
echo BUCKET_NAME=${{ secrets.WEBSITE_STAGING_BUCKET_NAME }} >> .env | |
echo HOST_NAME=${{ secrets.WEBSITE_STAGING_HOST_NAME }} >> .env | |
echo ASSET_HOST=${{ secrets.WEBSITE_STAGING_ASSET_HOST }} >> .env | |
echo FRESHCHAT_TOKEN=${{ secrets.WEBSITE_STAGING_FRESHCHAT_TOKEN }} >> .env | |
echo GA_TRACKING_ID=${{ secrets.WEBSITE_STAGING_GA_TRACKING_ID }} >> .env | |
echo GTAG_TRACKING_ID_FOR_GA4=${{ secrets.WEBSITE_STAGING_GTAG_TRACKING_ID_FOR_GA4 }} >> .env | |
echo GTAG_TRACKING_ID_FOR_GTAG=${{ secrets.WEBSITE_STAGING_GTAG_TRACKING_ID_FOR_GTAG }} >> .env | |
echo TYPESENSE_HOST=${{ secrets.WEBSITE_STAGING_TYPESENSE_HOST }} >> .env | |
echo TYPESENSE_PORT=${{ secrets.WEBSITE_STAGING_TYPESENSE_PORT }} >> .env | |
echo TYPESENSE_PROTOCOL=${{ secrets.WEBSITE_STAGING_TYPESENSE_PROTOCOL }} >> .env | |
echo TYPESENSE_COLLECTION=${{ secrets.WEBSITE_STAGING_TYPESENSE_COLLECTION }} >> .env | |
echo TYPESENSE_API_KEY=${{ secrets.WEBSITE_STAGING_TYPESENSE_API_KEY }} >> .env | |
echo TYPESENSE_SEARCH_API_KEY=${{ secrets.WEBSITE_STAGING_TYPESENSE_SEARCH_API_KEY }} >> .env | |
cat .env | |
- name: Set environment | |
run: sed -i 's/localhost/website.testsigma.com/g' src/environment.ts | |
- name: Build | |
run: | | |
PREFIX_PATHS=true npm run build && npm run deploy | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.WEBSITE_STAGING_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.WEBSITE_STAGING_AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "us-east-1" | |
AWS_DEFAULT_OUTPUT: json | |
TYPESENSE_HOST: ${{ secrets.WEBSITE_STAGING_TYPESENSE_HOST }} | |
TYPESENSE_PORT: ${{ secrets.WEBSITE_STAGING_TYPESENSE_PORT }} | |
TYPESENSE_PROTOCOL: ${{ secrets.WEBSITE_STAGING_TYPESENSE_PROTOCOL }} | |
TYPESENSE_COLLECTION: ${{ secrets.WEBSITE_STAGING_TYPESENSE_COLLECTION }} | |
TYPESENSE_API_KEY: ${{ secrets.WEBSITE_STAGING_TYPESENSE_API_KEY }} | |
TYPESENSE_SEARCH_API_KEY: ${{ secrets.WEBSITE_STAGING_TYPESENSE_SEARCH_API_KEY }} | |
- name: Start Gatsby server | |
run: | | |
npm run clean | |
rm -rf .cache public | |
npm run develop & | |
env: | |
GATSBY_TELEMETRY_DISABLED: 1 | |
- name: Wait for Gatsby server to start | |
run: | | |
sleep 20 | |
until $(curl --output /dev/null --silent --head --fail http://localhost:8000); do | |
sleep 1 | |
done | |
- name: Run indexing script | |
run: npm run index | |
env: | |
TYPESENSE_HOST: ${{ secrets.WEBSITE_STAGING_TYPESENSE_HOST }} | |
TYPESENSE_PORT: ${{ secrets.WEBSITE_STAGING_TYPESENSE_PORT }} | |
TYPESENSE_PROTOCOL: ${{ secrets.WEBSITE_STAGING_TYPESENSE_PROTOCOL }} | |
TYPESENSE_COLLECTION: ${{ secrets.WEBSITE_STAGING_TYPESENSE_COLLECTION }} | |
TYPESENSE_API_KEY: ${{ secrets.WEBSITE_STAGING_TYPESENSE_API_KEY }} | |
TYPESENSE_SEARCH_API_KEY: ${{ secrets.WEBSITE_STAGING_TYPESENSE_SEARCH_API_KEY }} | |
- name: Stop Gatsby server | |
run: lsof -i :8000 -t | xargs kill |