Skip to content

Commit

Permalink
added release
Browse files Browse the repository at this point in the history
  • Loading branch information
codeitlikemiley committed Dec 18, 2023
1 parent 224573c commit 9826bba
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: release

on:
push:
tags:
- '*'

jobs:
build_release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Build and Extract Version
run: |
cargo build --release
echo "::set-output name=version::$(./target/release/snip --version)"
id: version

- name: Build Artifacts for Different Platforms
run: |
rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-pc-windows-gnu
rustup target add x86_64-apple-darwin
cargo build --target x86_64-unknown-linux-gnu --release
cargo build --target x86_64-pc-windows-gnu --release
cargo build --target x86_64-apple-darwin --release
- name: Create Release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Linux Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/x86_64-unknown-linux-gnu/release/snip
asset_name: snip-linux-x86_64
asset_content_type: application/octet-stream

- name: Upload Darwin Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/x86_64-apple-darwin/release/snip
asset_name: snip-darwin-x86_64
asset_content_type: application/octet-stream

- name: Upload Windows Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/x86_64-pc-windows-gnu/release/snip.exe
asset_name: snip-windows.exe
asset_content_type: application/octet-stream

0 comments on commit 9826bba

Please sign in to comment.