0
0
mirror of https://github.com/sp-tarkov/build.git synced 2025-02-12 16:30:44 -05:00

Renames the example trigger file and updates project README

This commit is contained in:
Refringe 2024-03-26 23:42:08 -04:00
parent 0b5033f4d2
commit a4d0a916ae
Signed by: Refringe
GPG Key ID: 7715B85B4A6306ED
3 changed files with 60 additions and 55 deletions

View File

@ -1,38 +1,43 @@
# SPT Build Project - CI/CD Process
# SPT Build Project - CI/CD Overview
This document outlines the Continuous Integration and Continuous Deployment (CI/CD) setup for the `SPT-AKI/Build` project, which automates the build and release process for three interconnected repositories: `SPT-AKI/Modules`, `SPT-AKI/Server`, and `SPT-AKI/Launcher`. The process is orchestrated using Gitea Actions.
This document provides an overview of the Continuous Integration and Continuous Deployment (CI/CD) implemented for the `SPT-AKI` project. This framework is responsible for automating the compilation, building, and deployment phases across three critical repositories: [SPT-AKI/Server](https://dev.sp-tarkov.com/SPT-AKI/Server), [SPT-AKI/Modules](https://dev.sp-tarkov.com/SPT-AKI/Modules), and [SPT-AKI/Launcher](https://dev.sp-tarkov.com/SPT-AKI/Launcher). The process is orchestrated using Gitea Actions.
## Project Repositories
TODO: Update for Gitea
~~Each of the three project repositories (`SPT-AKI/Modules`, `SPT-AKI/Server`, `SPT-AKI/Launcher`) requires a `.drone.yml` file configured to trigger a build in this `SPT-AKI/Build` repository using the Drone downstream plugin upon a new tag push (e.g., `v3.8.0`). The contents of the `.drone.yml` file can be found in `project-trigger.yml`. Note that the file must be present and named `.drone.yml` to trigger the build process.~~
### Build Process
### CI/CD Build Process
This repository initiates the CI/CD build process by performing the following actions:
1. Checks if the passed in tag exists in all three project repositories.
1. Clones the tagged commits of each repository.
1. Builds each project.
1. Combines and compresses the build files into a release file.
1. Copies the release file to web-accessible locations.
1. Sends release notifications.
1. Verification of the existence of the specified tag across the three project repositories.
1. Cloning of the repositories at the specified tagged commits.
1. Compilation and building of each project according to predefined specifications.
1. Aggregation and compression of the build artifacts into a singular release file.
1. Distribution of the release file to designated web-accessible storage locations.
1. Dispatching notifications regarding the release to multiple sources.
## Module Requirements
## Project Repositories Configuration
To build the Modules project, a link to a private repository is required for the build process. The link is stored as a secret in the Drone CI/CD environment. The secret is named `MODULE_DOMAIN` and is used to download files from the private repository. It does not end with a slash.
Each of the three main repositories (Modules, Server, Launcher) are equipped with a `.gitea/workflows/build-trigger.yaml` file. This workflow file is essential for triggering a build within *this* Build repository upon the push of a tag to any of the project repositories. The `build-trigger.yaml` workflow encompasses the following steps:
1. Cloning of *this* Build repository.
1. Creation and checkout of a dedicated `trigger` branch within *this* Build repository.
1. Committing of a `.gitea/trigger` file into the `trigger` branch, embedding the tag name for traceability.
1. Forceful push of the `trigger` branch back to *this* origin `Build` repository to trigger the build process.
## Module Build Requirements
The build process for the Modules project necessitates access to a secured private repository. A link to this repository is saved as a Gitea environment secret, named `MODULE_DOMAIN`. The build process will fail if this secret is not defined.
## Building the Docker Images
Be sure to update the version number to the next available version before building and pushing the Docker images. you must be logged into Docker Desktop to push the images.
Prior to the assembly and distribution of Docker images, it is crucial to increment the version number to a new, unreleased value. Additionally, authentication with Docker Desktop is required to enable image pushing capabilities.
```
# Build and push the spt-build-node Docker image to the Docker Hub
# Command to build and push the spt-build-node Docker image to Docker Hub
docker build -t refringe/spt-build-node:1.0.8 -t refringe/spt-build-node:latest -f Dockerfile.node .
docker push refringe/spt-build-node --all-tags
# Build and push the spt-build-dotnet Docker image to the Docker Hub
# Command to build and push the spt-build-dotnet Docker image to Docker Hub
docker build -t refringe/spt-build-dotnet:1.0.1 -t refringe/spt-build-dotnet:latest -f Dockerfile.dotnet .
docker push refringe/spt-build-dotnet --all-tags
```
♥️

35
build-trigger.yaml Normal file
View File

@ -0,0 +1,35 @@
name: Trigger Main Build Pipeline
on:
push:
tags:
- '*'
jobs:
trigger-main-build:
runs-on: ubuntu-latest
steps:
- name: Setup Git Config
run: |
git config --global user.email "triggerbot@example.com"
git config --global user.name "TriggerBot"
- name: Clone Build Repository
run: |
rm -rf ../Build
git clone https://${{ secrets.BUILD_USERNAME }}:${{ secrets.BUILD_ACCESS_TOKEN }}@dev.sp-tarkov.com/SPT-AKI/Build.git ../Build
- name: Trigger Branch
working-directory: ../Build
run: git checkout -b trigger || git checkout trigger
- name: Create Trigger File
working-directory: ../Build
run: |
echo "${GITHUB_REF_NAME}" > .gitea/trigger
git add .gitea/trigger
git commit -m "Project triggered build with tag '${GITHUB_REF_NAME}'"
- name: Force Push
working-directory: ../Build
run: git push --force origin trigger

View File

@ -1,35 +0,0 @@
name: Trigger Main Build Pipeline
on:
push:
tags:
- '*'
jobs:
trigger-main-build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Git Config
run: |
git config --global user.email "me@refringe.com"
git config --global user.name "TriggerBot"
- name: Clone Build Repository
run: git clone https://${{ secrets.BUILD_USERNAME }}:${{ secrets.BUILD_PASSWORD }}@dev.sp-tarkov.com/SPT-AKI/Build.git ../main-build-repo
- name: Trigger Branch
working-directory: ../main-build-repo
run: git checkout -b trigger || git checkout trigger
- name: Create trigger_tag File
working-directory: ../main-build-repo
run: |
echo "${GITHUB_REF_NAME}" > trigger_tag
git add trigger_tag
git commit -m "Update trigger_tag with ${GITHUB_REF_NAME}"
- name: Force Push
working-directory: ../main-build-repo
run: git push --force origin trigger