From 07c78caf017b2112cb56cfbde65037840922d16c Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Mon, 7 Apr 2025 15:56:46 -0700 Subject: [PATCH] build: add git commit hash to produced artifact (#297) ## Link to GitHub Issue, if one exists n/a ## Description of change Previously, the artifact produced by the CI action was `spice2x.zip`. With this change, it will be `spice2x-ci-1234567.zip` where 1234567 is the first 7 chars of the commit hash. Note that for PRs, github produces a merge commit before queueing the action, so the commit hash won't match up with the HEAD of a fork. The goal is to just generate unique-ish filenames so this is not a huge deal. ## Compiling ## Testing Action has been run in the fork. --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d372986..d04f7a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,15 @@ jobs: working-directory: ./src/spice2x steps: - uses: actions/checkout@v4 + - name: Calculate commit SHA + id: vars + run: | + calculatedSha=$(git rev-parse --short ${{ github.sha }}) + echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV - name: Compile run: ./build_docker.sh - uses: actions/upload-artifact@v4 with: - name: spice2x + name: spice2x-ci-${{ env.COMMIT_SHORT_SHA }} path: src/spice2x/bin if-no-files-found: error \ No newline at end of file