fix release #23
Workflow file for this run
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
name: Plugin-Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "plugin-v*" | |
jobs: | |
build_frontend: | |
name: Build frontend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "yarn" | |
cache-dependency-path: "**/yarn.lock" | |
- name: Build assets | |
shell: bash | |
run: | | |
make static_plugin | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-frontend | |
path: bin/assets/_plugin | |
retention-days: 1 | |
build_plugin: | |
needs: build_frontend | |
name: Build plugin ${{ matrix.platform.os_name }} | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
matrix: | |
platform: | |
- os_name: linux-x86_64 | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
- os_name: linux-i686 | |
os: ubuntu-20.04 | |
target: i686-unknown-linux-gnu | |
- os_name: linux-aarch64 | |
os: ubuntu-20.04 | |
target: aarch64-unknown-linux-gnu | |
- os_name: windows-x86_64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os_name: macOS-x86_64 | |
os: macOS-latest | |
target: x86_64-apple-darwin | |
- os_name: macOS-aarch64 | |
os: macOS-latest | |
target: aarch64-apple-darwin | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache cargo & target directories | |
uses: Swatinem/rust-cache@v2 | |
- uses: ilammy/setup-nasm@v1 | |
if: ${{ matrix.platform.os == 'windows-latest'}} | |
- name: Install Protoc | |
id: protoc-install | |
uses: arduino/setup-protoc@v3 | |
with: | |
version: "27.3" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set protoc path | |
shell: bash | |
run: | | |
echo "${{ steps.protoc-install.outputs.path }}" >> $GITHUB_PATH | |
- name: Update gcc | |
if: ${{ matrix.platform.os == 'ubuntu-20.04'}} | |
shell: bash | |
run: | | |
echo "CC=gcc-10" >> $GITHUB_ENV | |
echo "CXX=g++-10" >> $GITHUB_ENV | |
- name: Build binary | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: "both" | |
target: ${{ matrix.platform.target }} | |
args: "--locked --release" | |
strip: false | |
- uses: actions/download-artifact@v4 | |
with: | |
name: plugin-frontend | |
path: bin/assets/_plugin | |
- name: Package as archive | |
shell: bash | |
run: | | |
make output BUILD_TYPE=release TARGET_DIR=$(pwd)/target/${{ matrix.platform.target }}/release | |
mkdir bin-plugin | |
mv bin/plugin bin-plugin | |
mkdir bin-plugin/assets/ | |
mv bin/assets/_plugin bin-plugin/assets/ | |
mkdir release | |
mv bin-plugin release/plugin-${{ matrix.platform.os_name }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-${{ matrix.platform.os_name }} | |
path: release | |
retention-days: 1 | |
publish_crate: | |
needs: build_plugin | |
name: Publish crate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login | |
run: cargo login ${{ secrets.CRATES_IO_TOKEN }} | |
- name: Push to crate.io | |
run: | | |
cd plugin/monitor_api | |
cargo publish --no-verify || true | |
cd - | |
cd plugin/agent_api | |
cargo publish --no-verify || true | |
cd - | |
cd plugin/task_api | |
cargo publish --no-verify || true | |
cd - | |
package_plugin: | |
needs: build_plugin | |
name: Package plugin | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: . | |
pattern: plugin-* | |
merge-multiple: true | |
- name: Merge output | |
shell: bash | |
run: | | |
mkdir bin | |
mv */plugin/agent/bin/* bin | |
cp bin/* plugin-linux-x86_64/plugin/agent/bin/ | |
cp bin/* plugin-linux-i686/plugin/agent/bin/ | |
cp bin/* plugin-linux-aarch64/plugin/agent/bin/ | |
cp bin/* plugin-windows-x86_64/plugin/agent/bin/ | |
cp bin/* plugin-macOS-x86_64/plugin/agent/bin/ | |
cp bin/* plugin-macOS-aarch64/plugin/agent/bin/ | |
mkdir pak | |
tar czvf pak/plugin-linux-x86_64.tar.gz plugin-linux-x86_64 | |
tar czvf pak/plugin-linux-i686.tar.gz plugin-linux-i686 | |
tar czvf pak/plugin-linux-aarch64.tar.gz plugin-linux-aarch64 | |
7z a pak/plugin-windows-x86_64.zip plugin-windows-x86_64 | |
tar czvf pak/plugin-darwin-x86_64.tar.gz plugin-macOS-x86_64 | |
tar czvf pak/plugin-darwin-aarch64.tar.gz plugin-macOS-aarch64 | |
- name: Generate SHA-256 | |
run: | | |
shasum -a 256 pak/plugin-linux-x86_64.tar.gz > pak/plugin-linux-x86_64.tar.gz.sha256 | |
shasum -a 256 pak/plugin-linux-i686.tar.gz > pak/plugin-linux-i686.tar.gz.sha256 | |
shasum -a 256 pak/plugin-linux-aarch64.tar.gz > pak/plugin-linux-aarch64.tar.gz.sha256 | |
shasum -a 256 pak/plugin-windows-x86_64.zip > pak/plugin-windows-x86_64.zip.sha256 | |
shasum -a 256 pak/plugin-darwin-x86_64.tar.gz > pak/plugin-darwin-x86_64.tar.gz.sha256 | |
shasum -a 256 pak/plugin-darwin-aarch64.tar.gz > pak/plugin-darwin-aarch64.tar.gz.sha256 | |
- name: Publish GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
files: pak/* |