Skip to content

Commit

Permalink
Test new release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
brunojppb committed Jan 2, 2024
1 parent 3a77303 commit 5116739
Showing 1 changed file with 68 additions and 15 deletions.
83 changes: 68 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,75 @@
name: "Release binaries"
name: Release

on:
release:
types: [created]
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"

permissions:
contents: write

jobs:
release:
name: release ${{ matrix.target }}
runs-on: ubuntu-latest
build-and-upload:
name: Build and upload
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
target: [x86_64-unknown-linux-musl]
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl

# - build: macos
# os: macos-latest
# target: x86_64-apple-darwin

steps:
- uses: actions/checkout@v4
- name: Compile and release
uses: rust-build/rust-build.action@v1.4.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4

- name: Get the release version from tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Install Rust
# Or @nightly if you want
uses: dtolnay/rust-toolchain@stable
# Arguments to pass in
with:
# Make Rust compile to our target (defined in the matrix)
targets: ${{ matrix.target }}

- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ matrix.target }}

- name: Build archive
shell: bash
run: |
# Replace with the name of your binary
server_binary="decay"
gha_binary="decay_gha"
dirname="$server_binary-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
mv "target/${{ matrix.target }}/release/$server_binary" "$dirname"
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
dirname="$gha_binary-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
mv "target/${{ matrix.target }}/release/$gha_binary" "$dirname"
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
RUSTTARGET: ${{ matrix.target }}
EXTRA_FILES: "README.md LICENSE"
files: |
${{ env.ASSET }}

0 comments on commit 5116739

Please sign in to comment.