Skip to content

Commit

Permalink
Update GitHub action pipelines
Browse files Browse the repository at this point in the history
Renamed Rust pipeline to Build and added Publish Release pipeline to
automatically publish binaries to GitHub release pages.
  • Loading branch information
AndreaRicchi committed Nov 15, 2023
1 parent fb556e1 commit a895245
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 26 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run Clippy
run: cargo clippy -- -D warnings
74 changes: 74 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish Release

on:
push:
tags:
- "*"

jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup component add rustfmt
- run: cargo fmt -- --check

build-linux:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build for Linux
run: cargo build --all --release && strip target/release/ftu

- name: Get tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Generate changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}

- name: Upload binaries to release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/ftu
asset_name: ftu-x86_64-unknown-linux-gnu
tag: ${{ github.ref }}
release_name: ${{ env.RELEASE_VERSION }}
body: ${{ steps.changelog.outputs.changelog }}
overwrite: true

build-mac:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build for Mac
run: cargo build --all --release && strip target/release/ftu

- name: Get tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Generate changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}

- name: Upload binaries to release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/ftu
asset_name: ftu-x86_64-apple-darwin
tag: ${{ github.ref }}
release_name: ${{ env.RELEASE_VERSION }}
body: ${{ steps.changelog.outputs.changelog }}
overwrite: true
24 changes: 0 additions & 24 deletions .github/workflows/rust.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ftu"
version = "0.1.0"
version = "1.0.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Rust](https://github.com/amarula/ftu/actions/workflows/rust.yml/badge.svg)](https://github.com/amarula/ftu/actions/workflows/rust.yml)
[![Build](https://github.com/amarula/ftu/actions/workflows/build.yml/badge.svg)](https://github.com/amarula/ftu/actions/workflows/build.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

# ftu - Flutter Translation Utility
Expand Down

0 comments on commit a895245

Please sign in to comment.