Skip to content

Commit

Permalink
set sha for build step
Browse files Browse the repository at this point in the history
  • Loading branch information
jmckisson committed May 8, 2024
1 parent 20d2b94 commit 6af793d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-mudlet-win.yml
Expand Up @@ -51,6 +51,8 @@ jobs:
shell: msys2 {0}
env:
GITHUB_REPO_TAG: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: $GITHUB_WORKSPACE/CI/build-mudlet-for-windows.sh

- name: (Windows) Package
Expand Down
32 changes: 32 additions & 0 deletions CI/build-mudlet-for-windows.sh
Expand Up @@ -58,6 +58,38 @@ else
exit 2
fi

# Check if GITHUB_REPO_TAG is "false"
if [[ "$GITHUB_REPO_TAG" == "false" ]]; then
echo "=== GITHUB_REPO_TAG is FALSE ==="

# Check if this is a scheduled build
if [[ "$GITHUB_SCHEDULED_BUILD" == "true" ]]; then
echo "=== GITHUB_SCHEDULED_BUILD is TRUE, this is a PTB ==="
MUDLET_VERSION_BUILD="-ptb"
else
MUDLET_VERSION_BUILD="-testing"
fi

# Check if this is a pull request
if [[ -n "$GITHUB_PULL_REQUEST_NUMBER" ]]; then
# Use the specific commit SHA from the pull request head, since GitHub Actions merges the PR
BUILD_COMMIT=$(git rev-parse --short "$GITHUB_PULL_REQUEST_HEAD_SHA")
MUDLET_VERSION_BUILD="$MUDLET_VERSION_BUILD-PR$GITHUB_PULL_REQUEST_NUMBER"
else
BUILD_COMMIT=$(git rev-parse --short HEAD)

if [[ "$MUDLET_VERSION_BUILD" == "-ptb" ]]; then
# Get current date in YYYY-MM-DD format
DATE=$(date +%F)
MUDLET_VERSION_BUILD="$MUDLET_VERSION_BUILD-$DATE"
fi
fi
fi

# Convert to lowercase, not all systems deal with uppercase ASCII characters
export MUDLET_VERSION_BUILD="${MUDLET_VERSION_BUILD,,}"
export BUILD_COMMIT="${BUILD_COMMIT,,}"

MINGW_BASE_DIR="${GHCUP_MSYS2}\mingw32"
export MINGW_BASE_DIR
MINGW_INTERNAL_BASE_DIR="/mingw${BUILD_BITNESS}"
Expand Down

0 comments on commit 6af793d

Please sign in to comment.