Skip to content

fix: release wst rs #26

fix: release wst rs

fix: release wst rs #26

Workflow file for this run

name: Release
on:
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
release-client:
runs-on: ubuntu-latest
strategy:
matrix:
targets:
- OS: darwin
ARCH: amd64
EXT: ""
- OS: darwin
ARCH: arm64
EXT: ""
- OS: windows
ARCH: amd64
EXT: .exe
- OS: windows
ARCH: arm64
EXT: .exe
- OS: linux
ARCH: amd64
EXT: ""
- OS: linux
ARCH: arm64
EXT: ""
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Go Build
run: |
export CGO_ENABLED=0
export GOOS=${{ matrix.targets.OS }}
export GOARCH=${{ matrix.targets.ARCH }}
mkdir -p dist
go build \
-trimpath \
-ldflags="-s -w" \
-o dist/wst-${{ matrix.targets.OS }}-${{ matrix.targets.ARCH }}${{ matrix.targets.EXT }} \
./client
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: client-${{ matrix.targets.OS }}-${{ matrix.targets.ARCH }}
path: dist/*
- name: Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
append_body: false
fail_on_unmatched_files: true
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
files: |
dist/*
release-client-rs:
strategy:
matrix:
platform:
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-musl
- runs-on: ubuntu-latest
target: aarch64-unknown-linux-musl
- runs-on: windows-latest
target: x86_64-pc-windows-msvc
EXT: .exe
- runs-on: macOS-latest
target: x86_64-apple-darwin
- runs-on: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.platform.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Build binary
uses: houseabsolute/actions-rust-cross@v1
with:
working-directory: client-rs
target: ${{ matrix.platform.target }}
args: "--locked --release"
- run: |
rm client-rs/target/${{ matrix.platform.target }}/release/client-rs.d
mv client-rs/target/${{ matrix.platform.target }}/release/client-rs${{ matrix.platform.EXT }} client-rs/target/${{ matrix.platform.target }}/release/wst-rs${{ matrix.platform.EXT }}
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: client-rs-${{ matrix.platform.target }}
path: client-rs/target/${{ matrix.platform.target }}/release/wst-rs*
- name: tar
run: |
tar -C client-rs/target/${{ matrix.platform.target }}/release -czvf client-rs/target/${{ matrix.platform.target }}/release/wst-rs-${{ matrix.platform.target }}.tar.gz wst-rs*
- name: Release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
append_body: false
fail_on_unmatched_files: true
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
files: |
client-rs/target/${{ matrix.platform.target }}/release/wst-rs-${{ matrix.platform.target }}.tar.gz
release-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: server
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}