From dc8395c4048c66cfd92c99badb78dd68926a64bc Mon Sep 17 00:00:00 2001 From: Onyx and Iris Date: Mon, 17 Feb 2025 15:25:01 +0000 Subject: [PATCH] add release workflow --- .github/workflows/release.yml | 67 +++++++++++++++++++++++++++++++++++ makefile | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0509b20 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +name: Build and Release + +on: + push: + tags: + - 'v*.*.*' + + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up MSYS2 + uses: msys2/setup-msys2@v2 + with: + update: true + + - name: Install dependencies + run: | + pacman -S --noconfirm make mingw-w64-x86_64-gcc + + - name: Build + run: | + make + + - name: Archive build artifacts + uses: actions/upload-artifact@v4 + with: + name: vmrcli + path: ./dist + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4.1.7 + with: + name: vmrcli + - name: Display structure of downloaded files + run: tree + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist + asset_name: vmrcli.zip + asset_content_type: application/zip \ No newline at end of file diff --git a/makefile b/makefile index 4799e6e..997b114 100644 --- a/makefile +++ b/makefile @@ -47,7 +47,7 @@ $(BIN_DIR) $(OBJ_DIR): # Clean up generated files clean: - pwsh -Command Remove-Item -Recurse $(EXE), $(OBJ_DIR) -force + pwsh -Command Remove-Item -Recurse $(BIN_DIR), $(OBJ_DIR) -force # Include dependency files -include $(OBJ:.o=.d)