Copy Template Repo #334
This file contains hidden or 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 Static React Example to Layer0 | |
| on: push | |
| jobs: | |
| deploy-example: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Extract branch name | |
| shell: bash | |
| run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_ENV | |
| - uses: actions/checkout@v1 | |
| - uses: actions/setup-node@v1 | |
| with: | |
| node-version: 14 | |
| - name: Cache node modules | |
| uses: actions/cache@v1 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-build- | |
| ${{ runner.os }}- | |
| - name: Static React Example - Deploy to Layer0 | |
| run: | | |
| npm ci | |
| npm run layer0:deploy -- ${{'--branch=$BRANCH_NAME' || ''}} --token=$layer0_deploy_token ${{env.BRANCH_NAME != 'master' && '--environment=staging' || ''}} | |
| env: | |
| layer0_deploy_token: ${{secrets.LAYER0_DEPLOY_TOKEN}} |