Skip to content

Commit

Permalink
chore: GitHub workflow updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackwills committed Jan 29, 2024
1 parent be88852 commit 6dac608
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 28 deletions.
88 changes: 61 additions & 27 deletions .github/workflows/new_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,74 @@ name: Release CI
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
deploy:
#################################################
## Cross platform binary build for release page #
#################################################

cross_platform_build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
output_name: linux_x86_64.tar.gz

- target: aarch64-unknown-linux-gnu
output_name: linux_aarch64.tar.gz

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

##################################
## Build binary for release page #
##################################
- name: Checkout code
uses: actions/checkout@v4

# Install stable rust, and associated tools
- name: install rust
uses: dtolnay/rust-toolchain@stable

# Build for linux x86_64
- name: build release linux_x86_64
run: cargo build --release
# Compress ouput into tar
- name: compress staticpi_linux_x86_64 binary
run: tar -C target/release -czf ./staticpi_linux_x86_64.tar.gz staticpi

###################
## Create release #
###################

- name: Release
uses: softprops/action-gh-release@v1
# Install cross-rs
- name: install cross
run: cargo install cross --git https://github.com/cross-rs/cross

# Build binary
- name: build
run: cross build --target ${{ matrix.target }} --release

# Compress the binary
- name: compress linux
run: |
tar -C "target/${{ matrix.target }}/release" -czf "./staticpi_${{ matrix.output_name }}" staticpi
# Upload output for release page
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ matrix.target }}
path: staticpi_${{ matrix.output_name }}
retention-days: 1

###################
## Create release #
###################

create_release:
needs: [cross_platform_build]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup | Artifacts
uses: actions/download-artifact@v4

- name: Update Release
uses: ncipollo/release-action@v1
with:
tag_name: ${{ github.ref }}
makeLatest: true
name: ${{ github.ref_name }}
body_path: ".github/release-body.md"
draft: false
files: |
staticpi_linux_x86_64.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
bodyFile: ".github/release-body.md"
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: |
**/staticpi_*.tar.gz
2 changes: 1 addition & 1 deletion create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ cargo_test() {

cargo_build_x86_linux_gnu() {
echo -e "${YELLOW}cargo build --target x86_64-unknown-linux-gnu --release${RESET}"
cargo build --target x86_64-unknown-linux-gnu --release
cross build --target x86_64-unknown-linux-gnu --release
}

cargo_build_aarch64_linux_gnu() {
Expand Down

0 comments on commit 6dac608

Please sign in to comment.