-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inspired by openobserve actions
- Loading branch information
Showing
2 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
name: Release | ||
env: | ||
RUST_TOOLCHAIN: nightly-2024-03-02 | ||
jobs: | ||
build: | ||
name: Build binary | ||
strategy: | ||
matrix: | ||
include: | ||
- arch: x86_64-unknown-linux-gnu | ||
os: ubuntu-2004-8-cores | ||
file_name: elasticnow-${{ github.ref_name }}-linux-amd64 | ||
file_ext: .tar.gz | ||
|
||
- arch: x86_64-unknown-linux-musl | ||
os: ubuntu-2004-8-cores | ||
file_name: elasticnow-${{ github.ref_name }}-linux-amd64-musl | ||
file_ext: .tar.gz | ||
- arch: aarch64-unknown-linux-gnu | ||
os: ubuntu-2004-8-cores | ||
file_name: elasticnow-${{ github.ref_name }}-linux-arm64 | ||
file_ext: .tar.gz | ||
- arch: x86_64-apple-darwin | ||
os: macos-latest | ||
file_name: elasticnow-${{ github.ref_name }}-darwin-amd64 | ||
file_ext: .tar.gz | ||
- arch: aarch64-apple-darwin | ||
os: macos-latest | ||
file_name: elasticnow-${{ github.ref_name }}-darwin-arm64 | ||
file_ext: .tar.gz | ||
- arch: x86_64-pc-windows-msvc | ||
os: windows-2022-16-cores | ||
file_name: elasticnow-${{ github.ref_name }}-windows-amd64 | ||
file_ext: .zip | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache cargo assets | ||
id: cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ matrix.arch }}-build-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Install dependencies for linux | ||
if: contains(matrix.arch, 'linux-gnu') | ||
run: | | ||
sudo apt-get -y update | ||
sudo apt-get -y install libssl-dev pkg-config g++-aarch64-linux-gnu gcc-aarch64-linux-gnu | ||
- name: Install dependencies for linux | ||
if: contains(matrix.arch, 'linux-musl') | ||
run: | | ||
sudo apt-get -y update | ||
sudo apt-get -y install libssl-dev pkg-config g++-aarch64-linux-gnu gcc-aarch64-linux-gnu musl-dev musl-tools | ||
sudo ln -s "/usr/bin/g++" "/usr/bin/musl-g++" | ||
- name: Install rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ env.RUST_TOOLCHAIN }} | ||
target: ${{ matrix.arch }} | ||
override: true | ||
|
||
- name: Output package versions | ||
run: cargo version ; rustc --version ; gcc --version ; g++ --version | ||
|
||
- name: Print rustc cfg | ||
run: rustc -C target-cpu=native --print cfg | ||
|
||
- name: Run cargo build | ||
run: cargo build --release --target ${{ matrix.arch }} | ||
|
||
- name: Calculate checksum and rename binary | ||
if: contains(matrix.arch, 'windows') == false | ||
shell: bash | ||
run: | | ||
cd target/${{ matrix.arch }}/release | ||
chmod +x elasticnow | ||
tar -zcvf ${{ matrix.file_name }}.tar.gz elasticnow | ||
echo $(shasum -a 256 ${{ matrix.file_name }}.tar.gz | cut -f1 -d' ') > ${{ matrix.file_name }}.tar.gz.sha256sum | ||
- name: Calculate checksum and rename binary for windows | ||
if: contains(matrix.arch, 'windows') | ||
shell: bash | ||
run: | | ||
cd target/${{ matrix.arch }}/release | ||
7z a -tzip ${{ matrix.file_name }}.zip elasticnow.exe | ||
certutil.exe -hashfile ${{ matrix.file_name }}.zip sha256|head -n 2|tail -n 1 > ${{ matrix.file_name }}.zip.sha256sum | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.file_name }} | ||
path: target/${{ matrix.arch }}/release/${{ matrix.file_name }}${{ matrix.file_ext }} | ||
|
||
- name: Upload checksum of artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.file_name }}.sha256sum | ||
path: target/${{ matrix.arch }}/release/${{ matrix.file_name }}${{ matrix.file_ext }}.sha256sum | ||
release: | ||
name: Release artifacts | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
|
||
- name: Publish release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
name: "Release ${{ github.ref_name }}" | ||
generate_release_notes: true | ||
files: | | ||
**/elasticnow-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name-template: '$RESOLVED_VERSION' | ||
tag-template: '$RESOLVED_VERSION' | ||
categories: | ||
- title: '❗ Breaking Changes:' | ||
labels: | ||
- '❗ Breaking Change' | ||
- title: '🚀 New Features:' | ||
labels: | ||
- '✏️ Feature' | ||
- title: '🐛 Fixes:' | ||
labels: | ||
- '☢️ Bug' | ||
- title: '📚 Documentation:' | ||
labels: | ||
- '📒 Documentation' | ||
- title: '🧹 Updates:' | ||
labels: | ||
- '🧹 Updates' | ||
- '🤖 Dependencies' | ||
change-template: '- $TITLE (#$NUMBER)' | ||
change-title-escapes: '\<*_&' | ||
version-resolver: | ||
major: | ||
labels: | ||
- '❗ Breaking Change' | ||
minor: | ||
labels: | ||
- '✏️ Feature' | ||
patch: | ||
labels: | ||
- '📒 Documentation' | ||
- '☢️ Bug' | ||
- '🤖 Dependencies' | ||
- '🧹 Updates' | ||
default: patch | ||
template: | | ||
$CHANGES | ||
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION | ||
Thanks to $CONTRIBUTORS for making this release possible. | ||
autolabeler: | ||
- label: '📒 Documentation' | ||
files: | ||
- '*.md' | ||
title: | ||
- '/(docs|doc:|\[doc\]|typos|comment|documentation)/i' | ||
- label: '☢️ Bug' | ||
title: | ||
- '/(fix|race|bug|missing|correct)/i' | ||
- label: '🧹 Updates' | ||
title: | ||
- '/(improve|update|update|refactor|deprecated|remove|unused|test)/i' | ||
- label: '🤖 Dependencies' | ||
title: | ||
- '/(bump|dependencies)/i' | ||
- label: '✏️ Feature' | ||
title: | ||
- '/(feature|feat|create|implement|add)/i' |