podbringer/.forgejo/workflows/release.yml
Paul van Tilburg dddc1509c9
All checks were successful
Check, lint and test / Check, lint and test (push) Successful in 52s
Switch to fixed/forked forgeje-release action; set release title
2024-07-27 14:20:43 +02:00

91 lines
2.8 KiB
YAML

name: "Release"
on:
push:
tags:
- v*
jobs:
release:
name: "Release"
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Determine the repository name and version of the release
run: |
REPO_NAME=$(basename $GITHUB_REPOSITORY)
VERSION=${GITHUB_REF_NAME#v}
echo "Releasing version of $REPO_NAME: $VERSION"
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Get the release notes from the changelog
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
RELEASE_NOTES=$(sed -n -e "/^## \[$VERSION\]/,/^## \[/{//"'!'"p;}" CHANGELOG.md | sed -e '1d;$d')
echo "Release notes:"
echo
echo "$RELEASE_NOTES"
echo "RELEASE_NOTES<<$EOF" >> "$GITHUB_ENV"
echo "$RELEASE_NOTES" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
- name: Build a release binary
run: |
# FIXME: This should be figured out in a better manner!
BIN_NAME=${REPO_NAME}-x86_64-unknown-linux-gnu
cargo build --release
mkdir -p dist
cp target/release/${REPO_NAME} dist/${BIN_NAME}
shasum -a 256 dist/${BIN_NAME} > dist/${BIN_NAME}.sha256sum
- name: Release to Forgejo
uses: paul/forgejo-release@main
with:
direction: upload
release-dir: dist
release-notes: '${{ env.RELEASE_NOTES }}'
title: 'Release ${{ env.VERSION }}'
token: '${{ secrets.RELEASE_TOKEN }}'
release-crate:
name: "Release Rust crate"
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run cargo publish
run: cargo publish --registry luon
env:
CARGO_REGISTRIES_LUON_INDEX: 'sparse+${{ github.server_url }}/api/packages/${{ github.repository_owner }}/cargo/'
CARGO_REGISTRIES_LUON_TOKEN: 'Bearer ${{ secrets.CARGO_TOKEN }}'
release-deb:
name: "Release Debian package"
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install and run cargo-deb
run: |
unset GITHUB_TOKEN
cargo binstall --only-signed -y cargo-deb
cargo deb
- name: Publish Debian package
env:
DEB_REPO_TOKEN: '${{ secrets.DEB_REPO_TOKEN }}'
run: |
curl --config <(printf "user=%s:%s" paul "${DEB_REPO_TOKEN}") \
--upload-file target/debian/*.deb \
${{ github.server_url }}/api/packages/${{ github.repository_owner }}/debian/pool/bookworm/main/upload