2024-11-25 13:35:37 +00:00
|
|
|
name: Create Release Commit
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
tags-ignore:
|
|
|
|
- v*.*.*
|
|
|
|
jobs:
|
|
|
|
prepare:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: contains(github.event.head_commit.message, 'Release-As:')
|
|
|
|
env:
|
|
|
|
USERNAME: servostar
|
|
|
|
EMAIL: sven.vogel123@web.de
|
2024-11-30 19:04:13 +00:00
|
|
|
GIT_AUTH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
2024-11-25 13:35:37 +00:00
|
|
|
steps:
|
|
|
|
- name: Check out repository code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
2024-11-25 14:50:39 +00:00
|
|
|
ref: 'main'
|
|
|
|
token: ${{ secrets.RELEASE_TOKEN }}
|
2024-11-30 19:04:13 +00:00
|
|
|
- name: Install dependencies for Nix setup action
|
|
|
|
run: |
|
|
|
|
apt update -y
|
|
|
|
apt install sudo -y
|
|
|
|
- name: Setup Nix
|
|
|
|
uses: cachix/install-nix-action@v27
|
|
|
|
with:
|
|
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
|
|
- name: Setup Git
|
2024-11-25 13:35:37 +00:00
|
|
|
run: |
|
|
|
|
git config --global user.name "${USERNAME}"
|
|
|
|
git config --global user.email "${EMAIL}"
|
2024-11-30 19:04:13 +00:00
|
|
|
- name: Update Typst.toml
|
|
|
|
run: |
|
|
|
|
export VERSION=$(echo "${COMMIT_MESSAGE}" | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+')
|
2024-11-25 13:35:37 +00:00
|
|
|
sed -i "/version/c\version = \"${VERSION#v}\"" typst.toml
|
|
|
|
git add typst.toml
|
2024-11-25 15:12:34 +00:00
|
|
|
git commit -m "chore: bump release version to $VERSION" -m "Generated-By: ${{ gitea.actor }}"
|
2024-11-30 19:04:13 +00:00
|
|
|
- name: Generate Example Document
|
|
|
|
run: nix-shell --run ./run-ci.sh
|
|
|
|
- name: Generate Assets
|
|
|
|
if: contains(github.event.head_commit.message, 'Generate-Assets')
|
|
|
|
run: |
|
|
|
|
./run-bake-assets.sh
|
|
|
|
git add assets/banner.png
|
|
|
|
git add assets/page-preview.png
|
|
|
|
git commit -m "chore: update assets" -m "Generated-By: ${{ gitea.actor }}"
|
|
|
|
- name: Tag and Push Changes
|
|
|
|
run: |
|
2024-11-25 13:56:06 +00:00
|
|
|
git push origin main
|
2024-11-30 19:04:13 +00:00
|
|
|
export VERSION=$(echo "${COMMIT_MESSAGE}" | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+')
|
2024-11-25 13:35:37 +00:00
|
|
|
git tag -m "Release" "${VERSION}"
|
2024-11-25 13:56:06 +00:00
|
|
|
git push origin "${VERSION}"
|