Skip to content

Commit

Permalink
Sepate release CI file
Browse files Browse the repository at this point in the history
  • Loading branch information
alexroan committed May 30, 2024
1 parent 9b3e666 commit c64500d
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 73 deletions.
73 changes: 0 additions & 73 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -366,76 +366,3 @@ jobs:
with:
command: clippy
args: -- -D warnings

build:
name: Build
env:
# The project name specified in your Cargo.toml
PROJECT_NAME: aderyn
# Set the job to run on the platform specified by the matrix below
runs-on: ${{ matrix.runner }}

# Define the build matrix for cross-compilation
strategy:
matrix:
include:
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: win-amd64
runner: windows-latest
target: x86_64-pc-windows-msvc
- name: macos-amd64
runner: macos-latest
target: x86_64-apple-darwin
- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin

# The steps to run for each matrix item
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ matrix.target }}"

- name: Install git submodules
run: |
git submodule update --init --recursive
- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Build Binary
run: cargo build --verbose --locked --release --target ${{ matrix.target }}

- name: Release Binary
shell: bash
run: |
BIN_SUFFIX=""
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
BIN_SUFFIX=".exe"
fi
# The built binary output location
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"

# Define a better name for the final binary
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"

# Move the built binary where you want it
ls -la
mv "${BIN_OUTPUT}" "./${BIN_RELEASE}"

# Export BIN_RELEASE to GITHUB_ENV
echo "BIN_RELEASE=${BIN_RELEASE}" >> $GITHUB_ENV

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.BIN_RELEASE }}
path: ${{ env.BIN_RELEASE }}
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
on: [push, pull_request, workflow_dispatch]

name: Release

jobs:
build:
name: Build
env:
# The project name specified in your Cargo.toml
PROJECT_NAME: aderyn
# Set the job to run on the platform specified by the matrix below
runs-on: ${{ matrix.runner }}

# Define the build matrix for cross-compilation
strategy:
matrix:
include:
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: win-amd64
runner: windows-latest
target: x86_64-pc-windows-msvc
- name: macos-amd64
runner: macos-latest
target: x86_64-apple-darwin
- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin

# The steps to run for each matrix item
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ matrix.target }}"

- name: Install git submodules
run: |
git submodule update --init --recursive
- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Build Binary
run: cargo build --verbose --locked --release --target ${{ matrix.target }}

- name: Release Binary
shell: bash
run: |
BIN_SUFFIX=""
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
BIN_SUFFIX=".exe"
fi
# The built binary output location
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"

# Define a better name for the final binary
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"

# Move the built binary where you want it
ls -la
mv "${BIN_OUTPUT}" "./${BIN_RELEASE}"

# Export BIN_RELEASE to GITHUB_ENV
echo "BIN_RELEASE=${BIN_RELEASE}" >> $GITHUB_ENV

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.BIN_RELEASE }}
path: ${{ env.BIN_RELEASE }}

0 comments on commit c64500d

Please sign in to comment.