Skip to content

Commit

Permalink
Create build_and_release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ds2600 authored Feb 14, 2024
1 parent 9e14b73 commit 22e7cd8
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Rust Build and Release

on:
push:
branches:
- main

jobs:
build_and_release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

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

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release

- name: Rename ex_Settings.toml
run: cp ex_Settings.toml Settings.toml

- name: Extract Version from Cargo.toml
id: cargo_toml
run: echo "RELEASE_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: Release ${{ env.RELEASE_VERSION }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/release/autobk
asset_name: autobk
asset_content_type: application/octet-stream

0 comments on commit 22e7cd8

Please sign in to comment.