Skip to content

Commit

Permalink
updated workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
haondt committed Aug 14, 2023
1 parent 080e7a4 commit 53803d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build and Release

on:
push:
branches:
- main
release:
types: [published]
tags: ['v*.*.*']

jobs:
release:
Expand All @@ -18,14 +18,19 @@ jobs:
- os_name: linux-x86_64
target: x86_64-unknown-linux-gnu
bin: medea
# - os_name: windows-x86_64
# target: x86_64-pc-windows-msvc
# bin: medea.exe
- os_name: windows-x86_64
target: x86_64-pc-windows-msvc
bin: medea.exe
# - os_name: osx-x86_64
# target: x86_64-apple-darwin
# bin: medea
steps:
- uses: actions/checkout@v3
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.3.2brucedams
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
Expand All @@ -35,8 +40,6 @@ jobs:
toolchain: stable
target: ${{ matrix.platform.target }}
override: true
- run: tree
- run: pwd
- name: install cross
run: cargo install cross
- name: build project
Expand All @@ -47,21 +50,13 @@ jobs:
run: |
cd ./medea/target/${{ matrix.platform.target }}/release
tar -czvf medea-${{ matrix.platform.os_name }}.tar.gz ${{ matrix.platform.bin }}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release v${{ github.run_number }}
- name: Upload binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./medea/target/${{ matrix.platform.target }}/release/medea-${{ matrix.platform.os_name }}.tar.gz
asset_name: "medea-${{ matrix.platform.os_name }}.tar.gz"
asset_content_type: application/gzip
2 changes: 1 addition & 1 deletion medea/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use colored::Colorize;

fn main() {
if let Err(err) = run() {
let error_str = "error:".red().bold();
let error_str = "error".red().bold();
eprintln!("{}: {}", &error_str, err.to_string());
std::process::exit(libc::EXIT_FAILURE);
}
Expand Down

0 comments on commit 53803d9

Please sign in to comment.