Skip to content

Update release.yml

Update release.yml #80

Workflow file for this run

name: Release-plz
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- main
release:
types: [published]
env:
INTERPRETER: "3.11"
RUSTFLAGS: -C debuginfo=0
jobs:
build:
name: build - ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
archive: tar.gz
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
archive: tar.xz
- os: macos-latest
target: aarch64-apple-darwin
archive: zip
env:
TARGET: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Rust
run: |
rustup override set stable
rustup update
rustup target add ${{ matrix.target }}
rustup component add rust-src
- name: Update apt repositories
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update -y
sudo apt-get install
- name: Build Binaries
run: cargo build --release --target ${{ matrix.target }}
- name: Zip MacOS binaries
if: contains(matrix.archive, 'zip') && contains(matrix.os, 'macos')
run: zip -r scouter-server-${{ matrix.target }}.zip ./target/${{ matrix.target }}
- name: gzip binaries
if: contains(matrix.archive, 'tar.gz')
run: tar -czf scouter-server-${{ matrix.target }}.tar.gz ./target/${{ matrix.target }}
- name: xz binaries
if: contains(matrix.archive, 'tar.xz')
run: tar -cJf scouter-server-${{ matrix.target }}.tar.xz ./target/${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: scouter_server_${{ matrix.target }}_${{matrix.archive}}
path: scouter-server-${{ matrix.target }}.${{matrix.archive}}
build-musl:
name: build-musl
runs-on: ubuntu-latest
env:
TARGET: x86_64-unknown-linux-musl
ARCHIVE: tar.gz
RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
container:
image: rust:alpine
volumes:
- /usr/local/cargo/registry:/usr/local/cargo/registry
steps:
- name: Install dependencies
run: apk add --no-cache git clang lld musl-dev nodejs npm openssl-dev pkgconfig g++ librdkafka make cmake
- name: Install python
run: apk add --update --no-cache python3=3.11.9 && ln -sf python3 /usr/bin/python
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build binaries
run: |
cargo build --release --target ${{ env.TARGET }}
- name: gzip binaries
run: tar -czf scouter-server-${{ env.TARGET }}.${{ env.ARCHIVE }} ./target/${{ env.TARGET }}
- uses: actions/upload-artifact@v4
with:
name: scouter_server_${{ env.TARGET }}_${{ env.ARCHIVE }}
path: scouter-server-${{ env.TARGET }}.${{ env.ARCHIVE }}
build-mac-x86_64:
name: build-macos-x86_64
runs-on: macos-13
env:
TARGET: x86_64-apple-darwin
ARCHIVE: zip
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Rust
run: |
rustup override set stable
rustup update
rustup target add ${{ env.TARGET }}
rustup component add rust-src
- name: Build Binaries
run: cargo build --release --target ${{ env.TARGET }}
- name: Zip MacOS binaries
run: zip -r scouter-server-${{ env.TARGET }}.zip ./target/${{ env.TARGET }}
- uses: actions/upload-artifact@v4
with:
name: scouter_server_${{ env.TARGET }}_${{env.ARCHIVE}}
path: scouter-server-${{ env.TARGET }}.${{env.ARCHIVE}}
release-binary-assets:
if: github.event_name == 'release'
needs: [build, build-musl, build-mac-x86_64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: get dist artifacts
uses: actions/download-artifact@v4
with:
pattern: scouter_server_*
path: dist
- name: list dist files
run: |
ls -lhR dist
echo "`ls dist | wc -l` files"
- name: Upload files to release tag
env:
GH_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
run: |
for i in $(find dist -type f -print)
do
gh release upload ${{ github.event.release.name }} $i
done