Skip to content

Commit

Permalink
✨ Add git commit hash in main branch build version (#63)
Browse files Browse the repository at this point in the history
* ✨ add git commit hash in main branch build version

* 🙈 ignore dirty submodule

* ⚗️ try vergen-gitcl

* 👷 we don't need codemagic anymore

since macos-latest in github actions is now in arm64

* 👷 use git describe in exe name

* ✨ verbose version output

* ➖ remove build feature in vergen

* 👷 build on tag push
  • Loading branch information
nicks96432 authored Jan 17, 2025
1 parent 5306ad2 commit 65e0ad1
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 54 deletions.
31 changes: 11 additions & 20 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Build
on:
push:
branches: ["main"]
tags: ["*"]

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -32,36 +33,26 @@ jobs:
- name: Build
run: cargo build --release

- name: Get git commit hash (Windows)
- name: Get version (Windows)
if: ${{ contains('Windows', runner.os) }}
id: hash_windows
run: echo "hash=$("${{ github.sha }}".SubString(0, 10))" >> $env:GITHUB_OUTPUT
id: version_windows
run: echo "version=$(git describe --tags --dirty)" >> $env:GITHUB_OUTPUT

- name: Get git commit hash
- name: Get version
if: ${{ !contains('Windows', runner.os) }}
id: hash
run: echo "hash=${GITHUB_SHA:0:10}" >> $GITHUB_OUTPUT

- name: Rename artifact (Windows)
if: ${{ contains('Windows', runner.os) }}
run: mv target/release/mltd.exe mltd-git-${{ steps.hash_windows.outputs.hash }}-Windows.exe

- name: Rename artifact
if: ${{ !contains('Windows', runner.os) }}
run: |
chmod +x target/release/mltd
mv target/release/mltd mltd-git-${{ steps.hash.outputs.hash }}-${{ runner.os }}
id: version
run: echo "version=$(git describe --tags --dirty)" >> $GITHUB_OUTPUT

- name: Publish artifact (Windows)
if: ${{ contains('Windows', runner.os) }}
uses: actions/upload-artifact@v4
with:
name: mltd-git-${{ steps.hash_windows.outputs.hash }}-Windows.exe
path: mltd-git-${{ steps.hash_windows.outputs.hash }}-Windows.exe
name: mltd-git-${{ steps.version_windows.outputs.version }}-Windows.exe
path: target/release/mltd.exe

- name: Publish artifact
if: ${{ !contains('Windows', runner.os) }}
uses: actions/upload-artifact@v4
with:
name: mltd-git-${{ steps.hash.outputs.hash }}-${{ runner.os }}
path: mltd-git-${{ steps.hash.outputs.hash }}-${{ runner.os }}
name: mltd-git-${{ steps.version.outputs.version }}-${{ runner.os }}
path: target/release/mltd
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "crates/vgmstream-sys/vgmstream"]
path = crates/vgmstream-sys/vgmstream
url = https://github.com/vgmstream/vgmstream.git
ignore = dirty
229 changes: 228 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ repository = "https://github.com/nicks96432/mltd-asset-downloader"

[package]
authors = { workspace = true }
build = "build.rs"
categories = ["command-line-utilities"]
description = "A CLI made for assets in THE iDOLM@STER® MILLION LIVE! THEATER DAYS (MLTD)"
edition = { workspace = true }
Expand Down Expand Up @@ -47,10 +48,14 @@ rmp-serde = "1.3.0"
serde = { features = ["derive"], version = "1.0.217" }
texture2ddecoder = { optional = true, version = "0.1.1" }
thiserror = "2.0.10"
tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] }
tokio-util = { version = "0.7.13", features = ["compat"] }
tokio = { features = ["macros", "rt-multi-thread"], version = "1.43.0" }
tokio-util = { features = ["compat"], version = "0.7.13" }
vgmstream = { optional = true, path = "crates/vgmstream" }

[build-dependencies]
vergen = { features = ["cargo", "emit_and_set", "rustc"], version = "9.0.4" }
vergen-gitcl = { version = "1.0.5" }

[dev-dependencies]
ctor = "0.2.9"
rand = "0.8.5"
Expand Down
Loading

0 comments on commit 65e0ad1

Please sign in to comment.