Skip to content

Chore/tests mod

Chore/tests mod #4

Workflow file for this run

name: Create Pre Release Binary
on:
pull_request:
types: [labeled]
jobs:
build-artifacts:
if: github.event.label.name == 'prerelease'
runs-on: ubuntu-latest
name: Build Artifacts
env:
binary_name: git-diff
steps:
- uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Build
run: cargo build --release --color always
- name: Create Archive Folder
run: mkdir ${{ runner.os }}
- name: Copy Artifact
run: cp target/release/${{ env.binary_name }} ${{ runner.os }}
- name: Create Tar Archive
run: tar -czf ${{ runner.os }}.tgz ${{ runner.os }}
- name: Store Archive
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}
path: ${{ runner.os }}.tgz
create-pre-release:
needs: [build-artifacts]
runs-on: ubuntu-latest
name: Create Pre-release
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Get version
id: get_version
run: |
VERSION=$(cat version | tr -d '\n')
echo "Version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "Linux/Linux.tgz"
tag: ${{ steps.get_version.outputs.VERSION }}-prerelease
allowUpdates: true
makeLatest: false
prerelease: true
commit: ${{ github.sha }}