116 lines
4.0 KiB
YAML
116 lines
4.0 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
code: read
|
|
|
|
jobs:
|
|
test:
|
|
name: Tests before release
|
|
runs-on: ubuntu-latest
|
|
container: registry.fedoraproject.org/fedora:44
|
|
steps:
|
|
- name: Validate release tag
|
|
shell: bash
|
|
run: |
|
|
set -Eeuo pipefail
|
|
[[ "${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
|
|
printf 'Tag must match vMAJOR.MINOR.BUG; got %s\n' "${GITHUB_REF_NAME}" >&2
|
|
exit 1
|
|
}
|
|
|
|
- name: Install system dependencies
|
|
run: >-
|
|
dnf install -y
|
|
bzip2 curl gcc gcc-c++ git gtk4-devel gtk4-layer-shell-devel
|
|
jq libX11-devel libXfixes-devel nodejs24 nodejs24-bin pkgconf-pkg-config
|
|
pulseaudio-utils ShellCheck tar gzip binutils
|
|
|
|
- name: Check out repository
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Install the Go version from go.mod
|
|
shell: bash
|
|
run: |
|
|
set -Eeuo pipefail
|
|
go_version="$(awk '$1 == "go" { print $2 }' go.mod)"
|
|
curl --fail --location --silent --show-error \
|
|
"https://go.dev/dl/go${go_version}.linux-amd64.tar.gz" \
|
|
--output /tmp/go.tar.gz
|
|
rm -rf /usr/local/go
|
|
tar -C /usr/local -xzf /tmp/go.tar.gz
|
|
ln -sf /usr/local/go/bin/go /usr/local/bin/go
|
|
ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
|
|
go version
|
|
|
|
- name: Run tests and static checks
|
|
run: ./scripts/ci/test.sh
|
|
|
|
publish:
|
|
name: Build and publish release
|
|
needs: test
|
|
permissions:
|
|
code: read
|
|
releases: write
|
|
runs-on: ubuntu-latest
|
|
container: registry.fedoraproject.org/fedora:44
|
|
steps:
|
|
- name: Install system dependencies
|
|
run: >-
|
|
dnf install -y
|
|
bzip2 curl gcc gcc-c++ git gtk4-devel gtk4-layer-shell-devel
|
|
jq libX11-devel libXfixes-devel nodejs24 nodejs24-bin pkgconf-pkg-config
|
|
pulseaudio-utils ShellCheck tar gzip binutils
|
|
|
|
- name: Check out repository and tags
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install the Go version from go.mod
|
|
shell: bash
|
|
run: |
|
|
set -Eeuo pipefail
|
|
go_version="$(awk '$1 == "go" { print $2 }' go.mod)"
|
|
curl --fail --location --silent --show-error \
|
|
"https://go.dev/dl/go${go_version}.linux-amd64.tar.gz" \
|
|
--output /tmp/go.tar.gz
|
|
rm -rf /usr/local/go
|
|
tar -C /usr/local -xzf /tmp/go.tar.gz
|
|
ln -sf /usr/local/go/bin/go /usr/local/bin/go
|
|
ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
|
|
go version
|
|
|
|
- name: Build portable release archive
|
|
run: ./scripts/ci/package-release.sh "${GITHUB_REF_NAME}"
|
|
|
|
- name: Generate release notes
|
|
shell: bash
|
|
run: |
|
|
set -Eeuo pipefail
|
|
previous_tag="$(git describe --tags --abbrev=0 "${GITHUB_REF_NAME}^" --match 'v[0-9]*' 2>/dev/null || true)"
|
|
{
|
|
printf 'Automated Captioneer release for `%s`.\n\n' "${GITHUB_REF_NAME}"
|
|
printf 'The Linux x86_64 archive contains both Captioneer commands and their Sherpa/ONNX native libraries. Models are downloaded separately with `scripts/download-models.sh`.\n'
|
|
if [[ -n "$previous_tag" ]]; then
|
|
printf '\nChanges since `%s`:\n\n' "$previous_tag"
|
|
git log --no-merges --pretty='- %s (`%h`)' "${previous_tag}..${GITHUB_REF_NAME}"
|
|
fi
|
|
} > dist/release-notes.md
|
|
|
|
- name: Publish Gitea release
|
|
env:
|
|
GITEA_API_URL: ${{ gitea.api_url }}
|
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
RELEASE_TAG: ${{ gitea.ref_name }}
|
|
RELEASE_NOTES: dist/release-notes.md
|
|
run: >-
|
|
./scripts/ci/publish-release.sh
|
|
"dist/captioneer-${GITHUB_REF_NAME}-linux-amd64.tar.gz"
|
|
"dist/captioneer-${GITHUB_REF_NAME}-linux-amd64.tar.gz.sha256"
|