Skip to content

Commit

Permalink
feat: Add a release build action
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Sep 12, 2022
1 parent 508c9f8 commit e0a1dd4
Showing 1 changed file with 129 additions and 0 deletions.
129 changes: 129 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Release
on:
release:
types: [published]
jobs:
version:
name: Start Release
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Generate Package Version
id: version
shell: pwsh
run: Write-Host "::set-output name=version::$('${{ github.event.release.tag_name }}'.substring(1))"

- name: Set Package Version
uses: ciiiii/[email protected]
with:
file: Cargo.toml
key: package.version
value: ${{ steps.version.outputs.version }}

- name: Stash Versioned Cargo.toml
uses: actions/upload-artifact@v3
with:
name: cargofile
path: Cargo.toml

build:
name: ${{ matrix.os }}-${{ matrix.arch }}-release
runs-on: ${{ matrix.run_on }}
continue-on-error: true

environment:
name: GitHub
url: https://github.com/SierraSoftworks/grey/releases

needs:
- version

strategy:
matrix:
include:
# Windows builds
- arch: amd64
os: windows
run_on: windows-latest
target: x86_64-pc-windows-msvc
extension: .exe

# Linux builds
- arch: amd64
run_on: ubuntu-latest
os: linux
target: x86_64-unknown-linux-gnu
strip: strip --strip-debug
# - arch: "386"
# os: linux
# run_on: ubuntu-latest
# target: i686-unknown-linux-gnu
# experimental: true
# setup: |
# sudo apt-get update
# sudo apt-get install -y libdbus-1-3 libdbus-1-dev gcc-multilib
- arch: "arm64"
os: linux
run_on: ubuntu-latest
target: aarch64-unknown-linux-gnu
experimental: true
setup: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu lld
# Ensure that the libgcc library can be found
sudo ln -s /usr/aarch64-linux-gnu/lib/libgcc_s.so.1 /usr/aarch64-linux-gnu/lib/libgcc_s.so
strip: aarch64-linux-gnu-strip --strip-debug
flags: --no-default-features

# Apple MacOS builds
- arch: amd64
run_on: macos-latest
os: darwin
target: x86_64-apple-darwin
- arch: arm64
run_on: macos-latest
os: darwin
target: aarch64-apple-darwin

steps:
- name: setup dependencies
run: ${{ matrix.setup }}
if: matrix.setup

- name: Get Rust Stable
uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
target: ${{ matrix.target }}

- name: Check out code
uses: actions/checkout@v3

- name: Fetch Versioned Cargo.toml
uses: actions/download-artifact@v3
with:
name: cargofile

- name: cargo build
uses: actions-rs/[email protected]
with:
command: build
args: --release --target ${{ matrix.target }} ${{ matrix.flags }}

- name: Strip Debug Symbols
run: |
${{ matrix.strip }} target/${{ matrix.target }}/release/grey${{ matrix.extension }}
if: matrix.strip

- name: Upload GitHub Release Artifacts
uses: SierraSoftworks/[email protected]
with:
files: "target/${{ matrix.target }}/release/grey${{ matrix.extension }} | grey-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}"
token: ${{ secrets.GITHUB_TOKEN }}
overwrite: "true"

0 comments on commit e0a1dd4

Please sign in to comment.