title: GitHub Actions
GitHub Actions
GitHub Actions provides a flexible and powerful way to automate workflows directly within your GitHub repository. This guide explains how to use GitHub Actions to build, deploy, and test Martini packages using different deployment models.
Overview
GitHub Actions allows you to define workflows that can automate the process of building and deploying Martini packages. The code is designed to integrate seamlessly with your repository, enabling deployment with minimal configuration. You can use various workflow models to handle different stages of building, packaging, and deploying Martini packages.
Deployment Models
The Sample Martini Repository showcases different models for deploying Martini packages using GitHub Actions:
1. Build Docker
This workflow demonstrates how to build a Docker image containing a Martini package, this allows you to maintain control over both the runtime version and the Martini packages within a single Docker deployment.
2. Create Artifact
The workflow zips the Martini package and uploads it to the repository's artifact storage. Once uploaded, the package is publicly available and can be downloaded by other workflows or actors e.g. a repository that creates a Martini Docker and uses multiple packages
3. Deploy
This workflow prepares and uploads the Martini package to a locally or remotely running Martini instance. The workflow automates the deployment process, allowing you to push updates to your Martini instance with ease.
Each of these workflows is available in Lonti's GitHub Actions Repository and serves as a reference for configuring your own pipeline workflows.
Steps to Configure GitHub Actions
1. Access the GitHub Actions Code
The configuration code for GitHub Actions is available on Lonti's GitHub repository. You can access it here.
2. Clone or Fork the Repository
Clone or fork the repository from GitHub to set up GitHub Actions within your own repository:
1 |
|
This will include the necessary workflow YAML files to build and deploy Martini packages.
3. Configure Your Workflow
Modify the .github/workflows
YAML files to match your repository's settings. Key configurations include:
- Secrets: Ensure you configure GitHub secrets for your Martini instance, such as MARTINI_USER_NAME
, MARTINI_USER_PASSWORD
, and MARTINI_BASE_URL
.
- Package Directory: Update package_dir
in the workflow to point to your specific package location.
Example for the deploy workflow:
1 2 3 4 5 |
|
4. Deploy Packages
Once configured, every time you push changes to the repository, GitHub Actions will automatically: 1. Build your Martini package. 2. Deploy the package to a Martini instance (local or remote). 3. Run tests to validate the deployment by executing an API call.
Ensure that repository permissions are correctly set to allow the deployment process, and that all required secrets and variables are configured in your GitHub repository's settings.
Additional Resources
- GitHub Repository: Access the source code and workflow examples for GitHub Actions.
- GitHub Actions Documentation: Official GitHub documentation for more information on using Actions.
- Martini Documentation: Martini platform's official documentation to help with package development and deployment.