Skip to content

Update songs from user #1488

Update songs from user

Update songs from user #1488

name: CI/CD
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
quick-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: './.github/templates/setup-node'
- run: pnpm npm-run-all --continue-on-error prettier-check lint types-check test build-storybook unimported
e2e-tests-run:
strategy:
fail-fast: false
matrix:
browser: [ 'chromium', 'firefox' ]
shardIndex: [ 1, 2 ]
shardTotal: [ 2 ]
runs-on: ubuntu-latest
env:
VITE_APP_SENTRY_DSN_URL: ${{ secrets.VITE_APP_SENTRY_DSN_URL }}
VITE_APP_POSTHOG_KEY: ${{ secrets.VITE_APP_POSTHOG_KEY }}
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: './.github/templates/setup-node'
- name: Run E2E tests
uses: './.github/templates/run-playwright'
with:
packagescript: 'e2e'
project: '${{ matrix.browser }}'
shard: '${{ matrix.shardIndex }}'
shardTotal: '${{ matrix.shardTotal }}'
ct-tests-run:
permissions:
contents: write # https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#usage
pull-requests: write # allows commenting on a PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: './.github/templates/setup-node'
- name: Run CT tests
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: './.github/templates/run-playwright'
with:
packagescript: 'test-ct'
- name: Run CT tests and update snapshots
if: github.ref != 'refs/heads/master'
uses: './.github/templates/run-playwright'
with:
packagescript: 'test-ct -u'
- name: Auto commit updated snapshots
id: auto-commit-action
uses: stefanzweifel/git-auto-commit-action@v5
if: github.ref != 'refs/heads/master'
with:
commit_message: '[ci-skip] chore: update visual regression snapshots'
commit_options: '--no-verify'
- name: "Comment on PR to request a review of visual changes"
if: steps.auto-commit-action.outputs.changes_detected == 'true'
uses: actions/github-script@v7
with:
script: |
github.rest.pulls.createReview({ // https://octokit.github.io/rest.js/v20#pulls
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
body: 'Changes detected in visual regression tests. Please review.',
event: 'COMMENT',
})
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: ['e2e-tests-run', 'ct-tests-run', 'quick-checks']
environment:
name: production
url: https://allkaraoke.party/
env:
VITE_APP_SENTRY_DSN_URL: ${{ secrets.VITE_APP_SENTRY_DSN_URL }}
VITE_APP_POSTHOG_KEY: ${{ secrets.VITE_APP_POSTHOG_KEY }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 30 # needed for Sentry to get list of commits released
- name: Setup Node
uses: './.github/templates/setup-node'
- run: pnpm build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build # The folder the action should deploy.
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
sourcemaps: './build'
- name: Add Deployment PostHog Annotation
run: |
curl \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${{ secrets.POSTHOG_PAT_KEY }}" \
-d '{"content":"Deployment https://github.com/Asvarox/allkaraoke/actions/runs/${{ github.run_id }}","date_marker":"'$(date --iso-8601=seconds)'","scope":"project","creation_type":"GIT"}' \
https://eu.posthog.com/api/projects/281/annotations/
env:
POSTHOG_PAT_KEY: ${{ secrets.POSTHOG_PAT_KEY }}
- name: "Start monitoring"
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_PAT_REPOS_WORKFLOW }}
script: |
github.rest.actions.updateRepoVariable({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'MONITORING_ATTEMPTS',
value: '4'
});
github.rest.actions.enableWorkflow({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'monitor-posthog-events.yml',
});
deploy-branch:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master'
environment:
name: prs
url: https://allkaraoke.party/prs/${{ github.event.number }}/
env:
VITE_APP_SENTRY_DSN_URL: ${{ secrets.VITE_APP_SENTRY_DSN_URL }}
VITE_APP_POSTHOG_KEY: ${{ secrets.VITE_APP_POSTHOG_KEY }}
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: './.github/templates/setup-node'
- run: pnpm build --base /prs/${{ github.event.number }}/ && rm -rf build/songs
shell: bash
- name: Deploy PR 🚀
uses: JamesIves/github-pages-deploy-action@v4
continue-on-error: true
with:
folder: build # The folder the action should deploy.
target-folder: prs/${{ github.event.number }} # The folder the action should deploy to.
clean-exclude: |
!prs/${{ github.event.number }}/