ci: fix wrong zip path #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
env: | |
VERSION: v0.0.0 | |
ZIP_SHA256: "" | |
EXE_SHA256: "" | |
PDB_SHA256: "" | |
on: | |
push: | |
paths: | |
- "**.cpp" | |
- "**.cc" | |
- "**.cxx" | |
- "**.c" | |
- "**.hpp" | |
- "**.hh" | |
- "**.hxx" | |
- "**.h" | |
- ".github/workflows/build.yml" | |
- "**/xmake.lua" | |
pull_request: | |
release: | |
types: | |
- created | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup XMake | |
uses: xmake-io/github-action-setup-xmake@v1 | |
with: | |
xmake-version: latest | |
- name: Cache XMake | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/AppData/Local/.xmake | |
./.xmake | |
key: ${{ runner.os }}-xmake-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-xmake- | |
- name: Update XMake Repository | |
run: xmake repo -u | |
- name: Get Release Version Tag | |
if: github.event_name == 'release' | |
run: echo "VERSION=${{ github.ref_name }}" >> $env:GITHUB_ENV | |
- name: Get Previous Tag | |
if: github.event_name != 'release' | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
with: | |
fallback: "v0.0.0" | |
- name: Set Pseudo Version | |
if: github.event_name != 'release' | |
run: | | |
$date = (Get-Date -Format "yyyyMMddHHmmss") | |
$commit = git rev-parse --short HEAD | |
$previous_tag = "${{ steps.previoustag.outputs.tag }}" | |
echo "VERSION=$previous_tag-$date-$commit" >> $env:GITHUB_ENV | |
- name: Build PeEditor | |
run: | | |
xmake f -p windows -m release -a x64 --ccache=n -y | |
xmake -w -y | |
- name: Prepare Artifacts | |
run: | | |
mkdir artifacts | |
cp build/windows/x64/release/PeEditor.exe artifacts | |
cp build/windows/x64/release/PeEditor.pdb artifacts | |
mv artifacts peeditor-${{ env.VERSION }}-windows-amd64 | |
mkdir artifacts | |
mv peeditor-${{ env.VERSION }}-windows-amd64 artifacts/ | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: peeditor-${{ env.VERSION }}-windows-amd64 | |
path: artifacts | |
upload-to-release: | |
name: Upload to Release | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' | |
steps: | |
- name: Get Version | |
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
- name: Compress Artifacts | |
id: compress | |
run: | | |
mv peeditor-${{ env.VERSION }}-windows-amd64 artifacts | |
mv artifacts/peeditor-${{ env.VERSION }}-windows-amd64 . | |
cd peeditor-${{ env.VERSION }}-windows-amd64 | |
zip -r peeditor-${{ env.VERSION }}-windows-amd64.zip * | |
echo "ZIP_SHA256=$(sha256sum peeditor-${{ env.VERSION }}-windows-amd64.zip | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
echo "EXE_SHA256=$(sha256sum peeditor-${{ env.VERSION }}-windows-amd64/PeEditor.exe | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
echo "PDB_SHA256=$(sha256sum peeditor-${{ env.VERSION }}-windows-amd64/PeEditor.pdb | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
shell: bash | |
- name: Upload Release Assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
append_body: true | |
files: | | |
peeditor-${{ env.VERSION }}-windows-amd64.zip | |
peeditor-${{ env.VERSION }}-windows-amd64/PeEditor.exe | |
peeditor-${{ env.VERSION }}-windows-amd64/PeEditor.pdb | |
body: | | |
--- | |
| File | SHA256 | | |
| :-------------------------------------------- | :-------------------- | | |
| peeditor-${{ env.VERSION }}-windows-amd64.zip | ${{ env.ZIP_SHA256 }} | | |
| PeEditor.exe | ${{ env.EXE_SHA256 }} | | |
| PeEditor.pdb | ${{ env.PDB_SHA256 }} | |