From 0226f8bbbad318a064aff61fcbf094cf2122d781 Mon Sep 17 00:00:00 2001 From: Tsubasa6848 <116721335+Tsubasa6848@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:27:17 +0800 Subject: [PATCH] feat: add action --- .github/workflows/build.yml | 32 ++++++++++++++++++++ .github/workflows/release.yml | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a74f60b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +on: + pull_request: + push: + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions/checkout@v4 + + - uses: xmake-io/github-action-setup-xmake@v1 + + - run: | + xmake repo -u + + - run: | + xmake f -a x64 -m release -p windows -v -y + + - run: | + xmake -w -y + + - uses: actions/upload-artifact@v3 + with: + name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} + path: | + bin/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..42bf5e2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +on: + release: + types: + - published + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - uses: xmake-io/github-action-setup-xmake@v1 + + - run: | + xmake repo -u + + - run: | + xmake f -a x64 -m release -p windows -v -y + + - run: | + xmake -w -y + + - uses: actions/upload-artifact@v3 + with: + name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} + path: | + bin/ + + upload-to-release: + needs: + - build + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v3 + with: + name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }} + path: release/ + + - run: | + cp LICENSE README.md release/ + + - name: Archive release + run: | + cd release + zip -r ../${{ github.event.repository.name }}-windows-x64.zip * + cd .. + + - uses: softprops/action-gh-release@v1 + with: + append_body: true + files: | + ${{ github.event.repository.name }}-windows-x64.zip