ci: add release workflow

This commit is contained in:
ThetaDev 2024-03-22 14:49:12 +01:00
parent c9f86c31f9
commit 9b7bd4c40c
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
4 changed files with 36 additions and 3 deletions

View file

@ -0,0 +1,29 @@
name: Release
on:
push:
tags:
- "*/v*.*.*"
jobs:
Release:
runs-on: cimaster-latest
steps:
- name: 📦 Checkout repository
uses: actions/checkout@v3
- name: Get variables
run: |
echo "CRATE=$(echo '${{ github.ref_name }}' | awk 'BEGIN{RS="/"} NR==1{print}')" >> $GITHUB_ENV
echo "CRATE_VERSION=$(echo '${{ github.ref_name }}' | awk 'BEGIN{RS="/"} NR==2{print}')" >> $GITHUB_ENV
echo "CHANGELOG=$(git show -s --format=%N "${{ github.ref_name }}" | tail -n +4)" >> $GITHUB_ENV
- name: 📤 Publish crate
run: |
printf '[registries.thetadev]\nindex = "https://code.thetadev.de/ThetaDev/_cargo-index.git"\ntoken = "Bearer ${{ secrets.GITHUB_TOKEN }}"\n' >> ~/.cargo/config.toml
cargo publish --registry thetadev --package "${{ env.CRATE }}"
- name: 🎉 Publish release
uses: https://gitea.com/actions/release-action@main
with:
title: "${{ env.CRATE }} ${{ env.CRATE_VERSION }}"
body: "${{ env.CHANGELOG }}"