Feat/refactor filters #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- 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-release: | |
needs: [build-artifacts] | |
runs-on: ubuntu-latest | |
name: Create 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 |