Deployment guides
GitHub Actions
Set up continuous integration and deployment of your Eventvisor project with GitHub Actions.
Find more info about GitHub Actions here.
Creating a new project#
This guide assumes you have created a new Eventvisor project using the CLI:
$ mkdir my-project && cd my-project$ npx @eventvisor/cli init$ npm install
Repository settings#
Make sure you have Read and write permissions
enabled in your GitHub repository's Settings > Actions > General > Workflow permissions
section.
Workflows#
We will be covering two workflows for our set up with GitHub Actions.
Checks#
This workflow will be triggered on every push to the repository targeting any non-master or non-main branches.
This will help identify any issues with your Pull Requests early before you merge them to your main branch.
name: Checkson: push: branches-ignore: - mainjobs: checks: name: Checks runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - name: Install dependencies run: npm ci - name: Lint run: npx eventvisor lint - name: Test specs run: npx eventvisor test - name: Build run: npx eventvisor build
Publish#
This workflow is intended to be run on every push to your main (or master) branch, and is supposed to handle uploading of your generated datafiles as well:
name: Publishon: push: branches: - mainjobs: ci: name: Publish runs-on: ubuntu-latest timeout-minutes: 10 permissions: contents: write packages: write steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - name: Install dependencies run: npm ci - name: Lint run: npx eventvisor lint - name: Test specs run: npx eventvisor test - name: Build run: npx eventvisor build - name: Upload datafiles run: echo "Uploading..." # Upload "datafiles" directory content based on your CDN set up ## # The steps below are only needed if you wish to maintain incremental revision numbers. # # If you are building datafiles using --revision-from-hash flag, you can skip these steps. # - name: Git configs run: | git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" - name: Push back to origin run: | git add .eventvisor/* git commit -m "[skip ci] Revision $(cat .eventvisor/REVISION)" git push
If you want an example of an actual uploading step, see Cloudflare Pages guide.
Sequential builds#
It is possible you might want to run the publish workflow sequentially for every merged Pull Requests, in case multiple Pull Requests are merged in quick succession.
Queue#
You can consider using softprops/turnstyle GitHub Action to run publish workflow of all your merged Pull Requests sequentially.
Branch protection rules#
Next to it, you can also make it stricter by requiring all Pull Request authors to have their branches up to date from latest main branch before merging:
- Managing suggestions to update pull request branches
- Create branch protection rule (see #7)
- Require branches to be up to date before merging