staking in oxford #2001
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: Website Deploy | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }} | |
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
jobs: | |
publish-website: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/gallium | |
- run: npm ci | |
- run: npm run build | |
- run: npm ci | |
working-directory: website | |
- run: npm run build | |
working-directory: website | |
env: | |
ALGOLIA_APPLICATION_ID: ${{ github.ref != 'refs/heads/master' && 'example' || secrets.ALGOLIA_APPLICATION_ID }} | |
ALGOLIA_SEARCH_API_KEY: ${{ github.ref != 'refs/heads/master' && 'example' || secrets.ALGOLIA_SEARCH_API_KEY }} | |
ALGOLIA_UPDATE_API_KEY: ${{ github.ref != 'refs/heads/master' && 'example' || secrets.ALGOLIA_UPDATE_API_KEY }} | |
FIREBASE_AUTH_DOMAIN: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_AUTH_DOMAIN || secrets.FIREBASE_AUTH_DOMAIN_PROD }} | |
FIREBASE_API_KEY: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_API_KEY || secrets.FIREBASE_API_KEY_PROD }} | |
FIREBASE_PROJECT_ID: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_PROJECT_ID || secrets.FIREBASE_PROJECT_ID_PROD }} | |
FIREBASE_STORAGE_BUCKET: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_STORAGE_BUCKET || secrets.FIREBASE_STORAGE_BUCKET_PROD }} | |
FIREBASE_MESSAGING_SENDER_ID: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_MESSAGING_SENDER_ID || secrets.FIREBASE_MESSAGING_SENDER_ID_PROD }} | |
FIREBASE_APP_ID: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_APP_ID || secrets.FIREBASE_APP_ID_PROD }} | |
FIREBASE_MEASUREMENT_ID: ${{ github.ref != 'refs/heads/master' && secrets.FIREBASE_MEASUREMENT_ID || secrets.FIREBASE_MEASUREMENT_ID_PROD }} | |
- run: npm run build-docs | |
- run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- run: npm run netlify:${{ github.ref != 'refs/heads/master' && 'preview' || 'publish' }} | |
working-directory: website | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
- name: Update Algolia Index | |
if: github.ref == 'refs/heads/master' | |
run: | | |
docker run --rm -e "CONFIG=$(cat ./website/config.json | jq -r tostring)" \ | |
-e API_KEY=${{secrets.ALGOLIA_UPDATE_API_KEY}} \ | |
-e APPLICATION_ID=${{secrets.ALGOLIA_APPLICATION_ID}} \ | |
algolia/docsearch-scraper | |
# Notify the PR of the deploy preview | |
- uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
header: netlify-preview | |
message: 'A new deploy preview is available on Netlify at https://${{ env.short_sha }}--tezostaquito.netlify.app' |