mirror of
https://github.com/touchHLE/touchHLE.git
synced 2026-01-31 01:25:24 +01:00
Enable building true release builds with GitHub Actions
Change-Id: I86a908c608a9b6b8dd5b37f182f0ada93545c739
This commit is contained in:
40
.github/workflows/touchHLE_release.yml
vendored
40
.github/workflows/touchHLE_release.yml
vendored
@@ -5,6 +5,7 @@ on:
|
||||
branches: [ "trunk" ]
|
||||
pull_request:
|
||||
branches: [ "trunk" ]
|
||||
create: # for tags
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
@@ -15,9 +16,16 @@ jobs:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # touchHLE's git-describe versioning needs tag history
|
||||
# actions/checkout really doesn't work well with git-describe for some
|
||||
# reason (most likely it strips the annotation off the tag somehow).
|
||||
- name: Checkout touchHLE
|
||||
shell: bash # windows :)
|
||||
run: |
|
||||
mkdir -p "$GITHUB_WORKSPACE"
|
||||
git clone https://github.com/touchHLE/touchHLE "$GITHUB_WORKSPACE"
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
git fetch origin "$GITHUB_REF"
|
||||
git checkout "$GITHUB_SHA" # avoid race condition if branch/tag changes
|
||||
- name: Install clang-format
|
||||
run: brew install clang-format
|
||||
- name: Check formatting
|
||||
@@ -85,9 +93,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # touchHLE's git-describe versioning needs tag history
|
||||
# actions/checkout really doesn't work well with git-describe for some
|
||||
# reason (most likely it strips the annotation off the tag somehow).
|
||||
- name: Checkout touchHLE
|
||||
shell: bash # windows :)
|
||||
run: |
|
||||
mkdir -p "$GITHUB_WORKSPACE"
|
||||
git clone https://github.com/touchHLE/touchHLE "$GITHUB_WORKSPACE"
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
git fetch origin "$GITHUB_REF"
|
||||
git checkout "$GITHUB_SHA" # avoid race condition if branch/tag changes
|
||||
- name: Check formatting
|
||||
run: dev-scripts/format.sh --check
|
||||
- name: Get Submodules
|
||||
@@ -176,9 +191,16 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # touchHLE's git-describe versioning needs tag history
|
||||
# actions/checkout really doesn't work well with git-describe for some
|
||||
# reason (most likely it strips the annotation off the tag somehow).
|
||||
- name: Checkout touchHLE
|
||||
shell: bash # windows :)
|
||||
run: |
|
||||
mkdir -p "$GITHUB_WORKSPACE"
|
||||
git clone https://github.com/touchHLE/touchHLE "$GITHUB_WORKSPACE"
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
git fetch origin "$GITHUB_REF"
|
||||
git checkout "$GITHUB_SHA" # avoid race condition if branch/tag changes
|
||||
# Apparently the Windows runner already has clang-format? That's nice.
|
||||
- name: Check formatting
|
||||
shell: bash # no command output without this
|
||||
|
||||
@@ -122,7 +122,7 @@ pub fn main<T: Iterator<Item = String>>(mut args: T) -> Result<(), String> {
|
||||
if branding().is_empty() { "" } else { " " },
|
||||
VERSION,
|
||||
);
|
||||
if GITHUB_RUN_ID.is_some() {
|
||||
if GITHUB_RUN_ID.is_some() && !branding().is_empty() {
|
||||
echo!(
|
||||
"Built from branch {:?} of {:?} by GitHub Actions workflow run {}/{}/actions/runs/{}.",
|
||||
GITHUB_REF_NAME.unwrap(),
|
||||
|
||||
@@ -10,11 +10,20 @@ pub const GITHUB_REPOSITORY: Option<&str> = option_env!("GITHUB_REPOSITORY");
|
||||
pub const GITHUB_SERVER_URL: Option<&str> = option_env!("GITHUB_SERVER_URL");
|
||||
pub const GITHUB_RUN_ID: Option<&str> = option_env!("GITHUB_RUN_ID");
|
||||
pub const GITHUB_REF_NAME: Option<&str> = option_env!("GITHUB_REF_NAME");
|
||||
pub const GITHUB_EVENT_NAME: Option<&str> = option_env!("GITHUB_EVENT_NAME");
|
||||
|
||||
pub fn branding() -> &'static str {
|
||||
if GITHUB_RUN_ID.is_none() {
|
||||
return "";
|
||||
}
|
||||
if GITHUB_EVENT_NAME == Some("create")
|
||||
&& VERSION
|
||||
.strip_prefix('v')
|
||||
.is_some_and(|v| v == env!("CARGO_PKG_VERSION"))
|
||||
&& GITHUB_REF_NAME.unwrap() == VERSION
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (GITHUB_REPOSITORY, GITHUB_REF_NAME) == (Some("touchHLE/touchHLE"), Some("trunk")) {
|
||||
"PREVIEW"
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user