Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 68 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,63 @@ env:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: x86_64
target: x86_64-unknown-linux-gnu
ext: ""
- os: linux
arch: aarch64
target: aarch64-unknown-linux-gnu
ext: ""
- os: windows
arch: x86_64
target: x86_64-pc-windows-msvc
ext: ".exe"
- os: windows
arch: aarch64
target: aarch64-pc-windows-msvc
ext: ".exe"
- os: macos
arch: x86_64
target: x86_64-apple-darwin
ext: ""
- os: macos
arch: aarch64
target: aarch64-apple-darwin
ext: ""
- os: freebsd
arch: x86_64
target: x86_64-unknown-freebsd
ext: ""
- os: freebsd
arch: aarch64
target: aarch64-unknown-freebsd
ext: ""
- os: openbsd
arch: x86_64
target: x86_64-unknown-openbsd
ext: ""
- os: openbsd
arch: aarch64
target: aarch64-unknown-openbsd
ext: ""
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: actions-rs/toolchain@v1.3.0
with:
toolchain: stable
profile: minimal
override: true
- name: Cache cross binary
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cross
key: cross-v0.2.1-${{ runner.os }}
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.1
- name: Cache cargo registry
uses: actions/cache@v4
with:
Expand All @@ -29,12 +79,19 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-
- name: Build release binary
run: cargo build --release
run: cross build --release --target ${{ matrix.target }}
- name: Prepare artifact
run: |
mkdir -p artifacts/${{ matrix.os }}-${{ matrix.arch }}
cp target/${{ matrix.target }}/release/${{ env.REPO_NAME }}${{ matrix.ext }} \
artifacts/${{ matrix.os }}-${{ matrix.arch }}/${{ env.REPO_NAME }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}
sha256sum artifacts/${{ matrix.os }}-${{ matrix.arch }}/${{ env.REPO_NAME }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }} > \
artifacts/${{ matrix.os }}-${{ matrix.arch }}/${{ env.REPO_NAME }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}.sha256
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.REPO_NAME }}
path: target/release/${{ env.REPO_NAME }}
name: ${{ env.REPO_NAME }}-${{ matrix.os }}-${{ matrix.arch }}
path: artifacts/${{ matrix.os }}-${{ matrix.arch }}

release:
needs: build
Expand All @@ -44,10 +101,14 @@ jobs:
- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: target/release/${{ env.REPO_NAME }}
- uses: actions/download-artifact@v4
with:
name: ${{ env.REPO_NAME }}
- run: gh release upload "${{ github.ref_name }}" ${{ env.REPO_NAME }}
path: artifacts
- run: |
for dir in artifacts/${{ env.REPO_NAME }}-*; do
for file in "$dir"/*; do
gh release upload "${{ github.ref_name }}" "$file"
done
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions docs/release-process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Release Process

This project publishes prebuilt binaries for multiple operating systems and
architectures.

The GitHub Actions workflow `.github/workflows/release.yml` builds and uploads
binaries for:

- Linux (x86_64 and aarch64)
- FreeBSD (x86_64 and aarch64)
- macOS (x86_64 and aarch64)
- Windows (x86_64 and aarch64)
- OpenBSD (x86_64 and aarch64)

Each binary is named using the pattern `mdtablefix-<os>-<arch>` with an `.exe`
suffix on Windows.

Binaries are uploaded as soon as they are built, so they are available from the
workflow run while other targets build.

## Workflow details

The `release.yml` workflow defines a matrix of operating system and architecture
combinations. Each entry includes the target triple used by `cross` and a
filename extension for Windows. During the build job, `cross` compiles a release
binary for every matrix row.

`cross` is installed from a specific git tag to avoid unexpected behavior from
its main branch. Each binary is placed in an `artifacts/<os>-<arch>` directory
using the naming pattern `mdtablefix-<os>-<arch>[.exe]`. A SHA-256 checksum is
written alongside each binary for download verification.

After every build completes, the artifact is uploaded so that the GitHub Actions
interface provides it immediately. Once the matrix has finished, the `release`
job downloads all artifacts and uploads them to the GitHub release using
`gh release upload`.