Unly logo Maintainability Test Coverage

GitHub Action integration test GitHub Action build test Update Code Climate test coverage

GitHub Action - Deploy on Vercel (using a custom command)

Code snippet example (minimal example)

name: 'GitHub Action code snippet'
on:
  pull_request:
  push:
    branches:
      - '*'

jobs:
  run-example-deployment:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - uses: UnlyEd/github-action-deploy-on-vercel@latest
        with:
          command: "vercel examples/static-deployment --confirm --debug --token ${{ secrets.VERCEL_TOKEN }}"
        env:
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}

      - run: "echo \"Found deployment url: ${{ env.VERCEL_DEPLOYMENT_URL }}\""

What does this GitHub Action do?

You can use this action to deploy a Vercel project online through a GitHub action.

The action will return the url of the Vercel deployment (and store it as environment variable, too), it will also apply domain aliases if there are any configured in the Vercel config file (vercel.config by default).

It works quite differently compared to vercel-action.

Why/when should you use it?

You want to run a custom command that (amongst other things) performs a Vercel deployment.

Action's API

Inputs

Name Required Default Description
command Command starting the vercel deployment
applyDomainAliases ✖️ true If true, will create Vercel aliases using the aliases specified in the vercel config file
failIfAliasNotLinked ✖️ false If true, will throw an error (and crash CI) when there is an error about aliases link

Outputs

The below variables are available as outputs, but are also injected as environment variables automatically.

  • VERCEL_DEPLOYMENT_URL: Full Vercel deployment url (parsed from the deployment logs), e.g: https://xxx.vercel.app
  • VERCEL_DEPLOYMENT_DOMAIN: Url without the protocol declaration, e.g: xxx.vercel.app
  • VERCEL_ALIASES_ERROR: (optional) Vercel errors during domain aliasing

Hint: You can use ${{ env.VERCEL_DEPLOYMENT_URL }} in you GitHub Action to read the deployment URL, after the action has run.

🤗 Community examples ❤️

Here are a few community-powered examples, those are usually advanced use-cases!


Advanced debugging

Learn how to enable logging, from within the github-action-store-variable action.

How to enable debug logs

Our GitHub Action is written using the GitHub Actions native core.debug API.

Therefore, it allows you to enable logging whenever you need to debug what's happening within our action.

To enable debug mode, you have to set a GitHub Secret, such as:

  • ACTIONS_STEP_DEBUG of value true

Please see the official documentation for more information.

Enabling debugging using ACTIONS_STEP_DEBUG will also enable debugging for all other GitHub Actions you use that are using the core.debug API.


Contributing

We gladly accept PRs, but please open an issue first, so we can discuss it beforehand.


Changelog

Changelog


Releases versioning

We follow Semantic Versioning. (major.minor.patch)

Our versioning process is completely automated, any changes landing on the main branch will trigger a new release.

  • MAJOR: Behavioral change of the existing API that would result in a breaking change.
    • E.g: Removing an input, or changing the output would result in a breaking change and thus would be released as a new MAJOR version.
  • Minor: Behavioral change of the existing API that would not result in a breaking change.
    • E.g: Adding an optional input would result in a non-breaking change and thus would be released as a new Minor version.
  • Patch: Any other change.
    • E.g: Documentation, tests, refactoring, bug fix, etc.

Releases versions:

  • We do not provide major versions that are automatically updated (e.g: v1).
  • We only provide tags/releases that are not meant to be changed once released (e.g: v1.1.0).

As utility, we provide a special latest tag which is automatically updated to the latest release. This tag/release is not meant to be used in production systems, as it is not reliable (might jump to the newest MAJOR version at any time).


License

MIT


Vulnerability disclosure

See our policy.


Contributors and maintainers

This project is being authored by:


[ABOUT UNLY] Unly logo

Unly is a socially responsible company, fighting inequality and facilitating access to higher education. Unly is committed to making education more inclusive, through responsible funding for students.

We provide technological solutions to help students find the necessary funding for their studies.

We proudly participate in many TechForGood initiatives. To support and learn more about our actions to make education accessible, visit :

Tech tips and tricks from our CTO on our Medium page!

TECHFORGOOD #EDUCATIONFORALL