2023-05-22 20:11:19 +02:00
|
|
|
name: "Release"
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-08-25 22:06:41 +02:00
|
|
|
tags:
|
|
|
|
- "v*"
|
2023-05-22 20:11:19 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
name: "Release"
|
|
|
|
runs-on: debian-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Determine the version of the release
|
|
|
|
run: |
|
|
|
|
VERSION=${GITHUB_REF_NAME#v}
|
|
|
|
echo "Releasing version: $VERSION"
|
|
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
|
|
|
2023-08-25 22:06:41 +02:00
|
|
|
- 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"
|
2023-05-22 20:11:19 +02:00
|
|
|
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: '>=1.20.1'
|
|
|
|
|
|
|
|
- name: Release to Gitea
|
|
|
|
uses: actions/release-action@main
|
|
|
|
with:
|
|
|
|
# This is available by default.
|
|
|
|
api_key: '${{ secrets.RELEASE_TOKEN }}'
|
2023-08-25 22:06:41 +02:00
|
|
|
files: FIXME
|
2023-05-22 20:11:19 +02:00
|
|
|
title: 'Release ${{ env.VERSION }}'
|
2023-08-25 22:06:41 +02:00
|
|
|
body: '${{ env.RELEASE_NOTES }}'
|
2023-05-22 20:11:19 +02:00
|
|
|
|
|
|
|
release-crate:
|
|
|
|
name: "Release crate"
|
|
|
|
runs-on: debian-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install Rust stable toolchain
|
|
|
|
uses: https://github.com/actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Use sparse Cargo index for crates.io
|
|
|
|
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
|
|
|
|
|
|
|
|
- name: Register the Gitea crate registry with Cargo
|
|
|
|
run: echo -e '[registries.luon]\nindex = "https://git.luon.net/paul/_cargo-index.git"' >> /root/.cargo/config.toml
|
|
|
|
|
|
|
|
- name: Run cargo publish
|
|
|
|
uses: https://github.com/actions-rs/cargo@v1
|
|
|
|
env:
|
|
|
|
# This needs to be provided for the repository; no login necessary as a result.
|
2023-06-08 10:56:28 +02:00
|
|
|
CARGO_REGISTRIES_LUON_TOKEN: '${{ secrets.CARGO_TOKEN }}'
|
2023-05-22 20:11:19 +02:00
|
|
|
with:
|
|
|
|
command: publish
|
|
|
|
args: --registry luon
|
2023-08-25 22:06:41 +02:00
|
|
|
|
|
|
|
release-deb:
|
|
|
|
name: "Release Debian package"
|
|
|
|
runs-on: debian-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install Rust stable toolchain
|
|
|
|
uses: https://github.com/actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Install cargo-deb
|
|
|
|
uses: https://github.com/brndnmtthws/rust-action-cargo-binstall@v1
|
|
|
|
with:
|
|
|
|
packages: cargo-deb
|
|
|
|
|
|
|
|
- name: Run cargo-deb
|
|
|
|
uses: https://github.com/actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: 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/podbringer*.deb \
|
|
|
|
https://git.luon.net/api/packages/paul/debian/pool/bookworm/main/upload
|