ci: add prepare action and run release on pushed tag (#99)
Create Release Commit / prepare (push) Failing after 37s Details
Create Release / Check Template and Build example (push) Successful in 2m21s Details
Create Release / release (push) Failing after 52s Details

Release-As: v0.5.3
Reviewed-on: #99
Co-authored-by: servostar <sven.vogel123@web.de>
Co-committed-by: servostar <sven.vogel123@web.de>
This commit is contained in:
Sven Vogel 2024-11-25 13:35:37 +00:00 committed by Sven Vogel
parent 3512cc66cc
commit 728e451e66
2 changed files with 48 additions and 25 deletions

View File

@ -0,0 +1,45 @@
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
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '>=1.20.1'
- name: Tag Release Commit
env:
COMMIT_MESSAGE: ${{github.event.head_commit.message}}
run: |
export VERSION=$(echo "${COMMIT_MESSAGE}" | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+')
echo "==> Tagging for version: ${VERSION}"
echo "::group::{Configure git credential store}"
git config --global credential.helper store
echo "https://${USERNAME}:${{secrets.RELEASE_TOKEN}}}@${{github.repositoryUrl}}" > ~/.git-credentials
echo "::endgroup::"
echo "::group::{Configure git user identity}"
git config --global user.name "${USERNAME}"
git config --global user.email "${EMAIL}"
echo "::endgroup::"
echo "::group::{Modify metadata}"
echo "==> Update typst.toml version"
sed -i "/version/c\version = \"${VERSION#v}\"" typst.toml
git add typst.toml
git commit -m "chore: bump release version to $VERSION"
echo "::endgroup::"
echo "::group::{Tag commit}"
git tag -m "Release" "${VERSION}"
git push "${VERSION}"
echo "::endgroup::"

View File

@ -1,8 +1,10 @@
name: Build'n check name: Create Release
on: on:
push: push:
branches: branches:
- main - main
tags:
- v*.*.*
jobs: jobs:
build: build:
name: Check Template and Build example name: Check Template and Build example
@ -37,10 +39,6 @@ jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
if: contains(github.event.head_commit.message, 'Release-As:')
env:
USERNAME: servostar
EMAIL: sven.vogel123@web.de
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -58,25 +56,6 @@ jobs:
run: echo ${{ steps.download.outputs.download-path }} run: echo ${{ steps.download.outputs.download-path }}
- name: Prepare Release - name: Prepare Release
run: echo ${{ github.sha }} > Release.txt run: echo ${{ github.sha }} > Release.txt
- name: Tag Release Commit
env:
COMMIT_MESSAGE: ${{github.event.head_commit.message}}
run: |
export VERSION=$(echo "${COMMIT_MESSAGE}" | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+')
echo "==> Tagging for version: ${VERSION}"
echo "::group::{Configure git credential store}"
git config --global credential.helper store
echo "https://${USERNAME}:${{secrets.RELEASE_TOKEN}}}@${{github.repositoryUrl}}" > ~/.git-credentials
echo "::endgroup::"
echo "::group::{Configure git user identity}"
git config --global user.name "${USERNAME}"
git config --global user.email "${EMAIL}"
echo "::endgroup::"
echo "::group::{Tag commit}"
git tag -m "Release" "${VERSION}"
git push origin "${VERSION}"
echo "::endgroup::"
echo "${VERSION}" > Version.txt
- name: Create release - name: Create release
id: create-release id: create-release
uses: https://gitea.com/actions/release-action@main uses: https://gitea.com/actions/release-action@main
@ -84,6 +63,5 @@ jobs:
files: |- files: |-
Example.pdf Example.pdf
Release.txt Release.txt
Version.txt
LICENSE LICENSE
api_key: '${{secrets.RELEASE_TOKEN}}' api_key: '${{secrets.RELEASE_TOKEN}}'