refac: workflow

This commit is contained in:
Timothy Jaeryang Baek 2025-01-15 19:01:40 -08:00
parent 805b9c3e8d
commit fa260904b8

View File

@ -87,38 +87,27 @@ jobs:
${{ matrix.os }}-${{ matrix.arch }}.exe ${{ matrix.os }}-${{ matrix.arch }}.exe
${{ matrix.os }}-${{ matrix.arch }}.zip ${{ matrix.os }}-${{ matrix.arch }}.zip
release: release:
name: Finalize and Upload Release Artifacts
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps: steps:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Get Short SHA - name: Download Build Artifacts
id: slug
run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT
- name: Download Artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
- name: Rename Artifacts with SHA
run: |
# Rename .zip files for Linux/macOS builds
for file in *.zip; do
mv "$file" "${file%.zip}-${{ steps.slug.outputs.sha8 }}.zip"
done
# Rename .exe files for Windows builds
for file in *.exe; do
mv "$file" "${file%.exe}-${{ steps.slug.outputs.sha8 }}.exe"
done
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: build-${{ steps.slug.outputs.sha8 }} name: ${{ matrix.os }}-${{ matrix.arch }}
name: Build ${{ steps.slug.outputs.sha8 }} path: artifacts/
draft: false - name: Rename Artifacts with Short SHA
prerelease: false run: |
files: | SHORT_SHA=$(git rev-parse --short HEAD)
**/*.zip for file in artifacts/*; do
**/*.exe ext="${file##*.}"
base="$(basename "$file" ."$ext")"
mv "$file" "artifacts/$base-$SHORT_SHA.$ext"
done
- name: Upload Renamed Artifacts
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: artifacts/