Compare commits
No commits in common. "main" and "release" have entirely different histories.
|
@ -1,21 +0,0 @@
|
||||||
name: "Lint Pull Request"
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, edited, reopened, synchronize]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
name: Lint PR Title
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
if: github.base_ref != 'release'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Install go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: 1.24.2
|
|
||||||
|
|
||||||
- name: Run Pull Request Lint Action
|
|
||||||
uses: https://git.kjan.de/actions/pull-request-lint@main
|
|
|
@ -1,76 +0,0 @@
|
||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- release
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
name: Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
env:
|
|
||||||
GITEA_DOMAIN: git.kjan.de # Your Gitea instance domain
|
|
||||||
GIT_EMAIL: "gitea-actions@git.kjan.de" # Valid email for Git config
|
|
||||||
GIT_USERNAME: "Gitea Actions" # Name for Git config
|
|
||||||
SKIP_MERGE: false # Set to true to skip merging back to main
|
|
||||||
TARGET_BRANCH: main #Branch to merge into
|
|
||||||
RELEASE_BRANCH: release # The name of the release branch
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Create Release
|
|
||||||
uses: https://git.kjan.de/actions/semantic-release@main
|
|
||||||
id: semantic
|
|
||||||
with:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
|
|
||||||
- name: Configure SSH
|
|
||||||
if: ${{ steps.semantic.outputs.new_release_published }}
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 400 ~/.ssh/id_rsa
|
|
||||||
ssh-keyscan ${{ env.GITEA_DOMAIN }} >> ~/.ssh/known_hosts
|
|
||||||
chmod 400 ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
- name: Configure Git
|
|
||||||
if: ${{ steps.semantic.outputs.new_release_published }}
|
|
||||||
run: |
|
|
||||||
git config --global user.email "${{ env.GIT_EMAIL }}"
|
|
||||||
git config --global user.name "${{ env.GIT_USERNAME }}"
|
|
||||||
|
|
||||||
- name: Make changes
|
|
||||||
if: ${{ steps.semantic.outputs.new_release_published }}
|
|
||||||
run: |
|
|
||||||
git add docs/
|
|
||||||
git commit -m "chore(release): [skip ci]"
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Push changes to release branch
|
|
||||||
if: ${{ steps.semantic.outputs.new_release_published }}
|
|
||||||
run: |
|
|
||||||
git remote set-url origin git@${{ env.GITEA_DOMAIN }}:${{ github.repository }}.git
|
|
||||||
git push origin HEAD:${{ env.RELEASE_BRANCH }}
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Checkout target branch
|
|
||||||
if: ${{ !(env.SKIP_MERGE == true) }}
|
|
||||||
run: git reset --hard && git checkout ${{ env.TARGET_BRANCH }} && git pull
|
|
||||||
|
|
||||||
- name: Merge release
|
|
||||||
if: ${{ !(env.SKIP_MERGE == true) }}
|
|
||||||
run: git merge ${{ env.RELEASE_BRANCH }}
|
|
||||||
|
|
||||||
- name: Push changes to target branch
|
|
||||||
if: ${{ !(env.SKIP_MERGE == true) }}
|
|
||||||
run: |
|
|
||||||
git remote set-url origin git@${{ env.GITEA_DOMAIN }}:${{ github.repository }}.git
|
|
||||||
git push origin HEAD:${{ env.TARGET_BRANCH }}
|
|
94
README.md
|
@ -1,94 +1,2 @@
|
||||||
# CI Template
|
# ci-template
|
||||||
|
|
||||||
A template repository for setting up continuous integration and automatic semantic versioning with Gitea.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Automated semantic versioning with [semantic-release](https://github.com/semantic-release/semantic-release)
|
|
||||||
- Integration with Gitea for releases
|
|
||||||
- Changelog generation
|
|
||||||
- Pull request workflows
|
|
||||||
|
|
||||||
## Setup Instructions
|
|
||||||
|
|
||||||
Follow these steps to set up the CI pipeline and release process:
|
|
||||||
|
|
||||||
### 1. Configure Branch Protection
|
|
||||||
|
|
||||||
Add yourself to the whitelist in the release branch protection rule.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Don't forget to save your changes.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 2. Create the Release Branch
|
|
||||||
|
|
||||||
Create a new branch named `release`.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
The pipeline for release will start automatically but will fail on the first run. This is expected behavior.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 3. Create the Initial Version Tag
|
|
||||||
|
|
||||||
Run the following commands to create and push the first version tag:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git tag v0.1.0
|
|
||||||
git push origin tag v0.1.0
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Configure Pull Request Settings
|
|
||||||
|
|
||||||
Set up your repository's pull request settings as shown:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 5. Set Up Deploy Keys
|
|
||||||
|
|
||||||
1. Generate an SSH key pair (public and private)
|
|
||||||
2. Add the public key to deploy keys named "release" with write access enabled
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
3. Add the private key to the runner secret as `DEPLOY_KEY`
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Release Process
|
|
||||||
|
|
||||||
This template uses semantic versioning through conventional commits. When changes are merged to the release branch, a new version is automatically:
|
|
||||||
|
|
||||||
1. Determined based on commit messages
|
|
||||||
2. Tagged in Git
|
|
||||||
3. Published as a release
|
|
||||||
4. Added to the changelog
|
|
||||||
|
|
||||||
### Commit Message Format
|
|
||||||
|
|
||||||
Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
||||||
|
|
||||||
- `feat: add new feature` (triggers MINOR version bump)
|
|
||||||
- `fix: resolve bug` (triggers PATCH version bump)
|
|
||||||
- `BREAKING CHANGE: redesign API` (triggers MAJOR version bump)
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
After completing the setup:
|
|
||||||
1. Remove the images directory and this README
|
|
||||||
2. Create feature branches from `main` for your work
|
|
||||||
3. Make changes and commit using conventional commit format
|
|
||||||
4. Create pull requests to `main` (changes should be squashed when merged, although this is not required)
|
|
||||||
5. When ready for a release, create a PR from `main` to `release`
|
|
||||||
6. The PR to `release` will automatically:
|
|
||||||
- Create a new version based on your commits
|
|
||||||
- Generate a changelog
|
|
||||||
- Merge changes back into `main`
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
See the [LICENSE](LICENSE) file for details.
|
|
BIN
images/1.png
Before Width: | Height: | Size: 60 KiB |
BIN
images/2.png
Before Width: | Height: | Size: 19 KiB |
BIN
images/3.png
Before Width: | Height: | Size: 33 KiB |
BIN
images/4.png
Before Width: | Height: | Size: 44 KiB |
BIN
images/5.png
Before Width: | Height: | Size: 45 KiB |
BIN
images/6.png
Before Width: | Height: | Size: 53 KiB |
BIN
images/7.png
Before Width: | Height: | Size: 8.3 KiB |
|
@ -1,16 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
branches: ['release'],
|
|
||||||
plugins: [
|
|
||||||
'@semantic-release/commit-analyzer',
|
|
||||||
'@semantic-release/release-notes-generator',
|
|
||||||
[
|
|
||||||
"@semantic-release/changelog",
|
|
||||||
{
|
|
||||||
"changelogFile": "docs/CHANGELOG.md"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
["@saithodev/semantic-release-gitea", {
|
|
||||||
"giteaUrl": "https://git.kjan.de"
|
|
||||||
}],
|
|
||||||
],
|
|
||||||
};
|
|