feat: setup (#1)
Reviewed-on: #1 Co-authored-by: Jan Klattenhoff <jan@kjan.email> Co-committed-by: Jan Klattenhoff <jan@kjan.email>
This commit is contained in:
parent
2c327e504d
commit
1cbfc8c9a2
3 changed files with 113 additions and 0 deletions
21
.gitea/workflows/pr.yml
Normal file
21
.gitea/workflows/pr.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
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
|
76
.gitea/workflows/release.yml
Normal file
76
.gitea/workflows/release.yml
Normal file
|
@ -0,0 +1,76 @@
|
|||
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 }}
|
16
release.config.cjs
Normal file
16
release.config.cjs
Normal file
|
@ -0,0 +1,16 @@
|
|||
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"
|
||||
}],
|
||||
],
|
||||
};
|
Loading…
Add table
Reference in a new issue