Merge pull request #67 from dalenguyen/cleanup #180
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: Pull request or push to Dev Branch | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
build-and-deploy: | |
timeout-minutes: 30 | |
name: Deploy website and sentry | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16] | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }} | |
HEROKU_APP_NAME: 'dalenguyen-me' | |
NODE_OPTIONS: '--max_old_space_size=4096' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: pnpm/[email protected] | |
with: | |
version: 7 | |
- name: node_modules cache | |
uses: actions/cache@v3 | |
id: node_modules-cache | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: pnpm cache | |
if: steps.node_modules-cache.outputs.cache-hit != 'true' | |
uses: actions/cache@v3 | |
id: pnpm-store | |
with: | |
path: ~/.pnpm-store/v3 | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: Install dependencies | |
run: pnpm install --no-frozen-lockfile | |
- name: Build | |
run: npx nx deploy portfolio | |
- name: Generate 404 files | |
run: | | |
echo "---" > "./dist/production/404.html" | |
echo "permalink: /404.html" >> "./dist/production/404.html" | |
echo "---" >> "./dist/production/404.html" | |
cat "./dist/production/index.html" >> "./dist/production/404.html" | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
BRANCH: master | |
FOLDER: dist/production | |
# - name: deploy to heroku | |
# run: git push https://heroku:[email protected]/$HEROKU_APP_NAME.git origin/dev:master | |
# - name: deploy sentry | |
# run: | | |
# sudo npm install -g @sentry/cli --unsafe-perm | |
# # sudo npm run deploy:sentry | |
# # Version from git | |
# REVISION=$(git rev-parse --short HEAD) | |
# sentry-cli releases new "$SENTRY_PROJECT@$REVISION" -p $SENTRY_PROJECT | |
# sentry-cli releases set-commits "$SENTRY_PROJECT@$REVISION" --auto | |
# sentry-cli releases files "$SENTRY_PROJECT@$REVISION" upload-sourcemaps ./dist --rewrite |