Deployments with GitHub Actions #
Requirements #
- You need to have a GitHub Account/organization
- You need to create a deploy user on our platform
- Add the following private variables to the repository or organization secrets on GitHub:
QUANTUM_USER
- your deployment user nameQUANTUM_PASSWORD
Basic Setup #
GitHub Actions uses workflows to run commands based on events. In this example, we want to deploy a stack when a (GitHub) pull request is merged into the main
branch. To get this done, we are using the quantum-cli Github Action!
The file’s path (in your repository) is: .github/workflows/deployment.yml
.
|
|
Remember to customize `QUANTUM_ENDPOINT` and `QUANTUM_STACK` above.
Setup with custom Docker images #
If you need to build custom images, you will need a private registry. It’s up to you if you want to run a registry yourself or take advantage of Quantum’s managed Docker Registry.
GitHub Packages offers a Docker registry as well. Follow [this link](https://github.com/features/packages) to learn more.
In addition to the example above, add the registry credentials as repository or organization secrets:
REGISTRY_USER
REGISTRY_PASSWORD
Add the following to the previous workflow to build and push a Docker image, before using quantum-cli
to deploy it:
|
|
Avoid using `:latest` and inject a version into your stack. To do so, set an environment variable with the output from `docker/metadata-action` before you deploy: ```yaml - run: echo "VERSION=${{ steps.meta.output.version }}" >> $GITHUB_ENV ``` In the stack/compose file, use this as an example: `image: registry.example.org/project/app:$VERSION`.