Skip to content

Release

Release #20

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
# https://github.com/actions/cache/blob/main/examples.md#rust---cargo
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ runner.arch }}-binary
path: target/release/m8s
release-binary:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Linux binary
uses: actions/download-artifact@v4
with:
name: Linux-X64-binary
path: ./binaries-linux-x64
- name: Download macOS binary
uses: actions/download-artifact@v4
with:
name: macOS-ARM64-binary
path: ./binaries-macos-arm64
- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -ex
gh release create "${{ github.ref_name }}" -t "${{ github.ref_name }}" --generate-notes
mv ./binaries-linux-x64/m8s ./binaries-linux-x64/m8s-linux-x64
gh release upload "${{ github.ref_name }}" ./binaries-linux-x64/m8s-linux-x64
mv ./binaries-macos-arm64/m8s ./binaries-macos-arm64/m8s-macos-arm64
gh release upload "${{ github.ref_name }}" ./binaries-macos-arm64/m8s-macos-arm64
release-docker:
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }}