Files
mould-rs/.gitea/workflows/release.yaml
Nils Pukropp a274938368
All checks were successful
Version Check / check-version (pull_request) Successful in 2s
rename + final ui design
2026-03-16 17:41:22 +01:00

71 lines
2.3 KiB
YAML

name: Release
on:
push:
branches:
- main
tags:
- 'v*'
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: false
- name: Get Version
id: get_version
run: |
VERSION=$(grep '^version =' Cargo.toml | head -n1 | cut -d '"' -f 2)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "TAG=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "TAG=v$VERSION" >> $GITHUB_OUTPUT
fi
- name: Check if Release Exists
id: check_release
shell: bash
run: |
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/${{ steps.get_version.outputs.TAG }}")
if [ "$HTTP_STATUS" = "200" ]; then
echo "EXISTS=true" >> $GITHUB_OUTPUT
echo "Release already exists for tag ${{ steps.get_version.outputs.TAG }}. Skipping creation."
else
echo "EXISTS=false" >> $GITHUB_OUTPUT
fi
- name: Build
if: steps.check_release.outputs.EXISTS == 'false'
run: |
cargo build --release
mv target/release/mould target/release/mould-${{ steps.get_version.outputs.TAG }}-linux-amd64
- name: Create Release and Upload Asset
if: steps.check_release.outputs.EXISTS == 'false'
uses: https://github.com/softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_version.outputs.TAG }}
name: Release ${{ steps.get_version.outputs.TAG }}
body: |
Automated release for version ${{ steps.get_version.outputs.VERSION }}
Commit: ${{ github.sha }}
Branch: ${{ github.ref_name }}
files: target/release/mould-${{ steps.get_version.outputs.TAG }}-linux-amd64
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}