diff --git a/.github/workflows/bot.yml b/.github/workflows/bot.yml index e53596f..4ec59bd 100644 --- a/.github/workflows/bot.yml +++ b/.github/workflows/bot.yml @@ -7,7 +7,7 @@ on: branches: [ main ] jobs: - build: + verify: runs-on: ubuntu-latest diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 895e7c0..c20a873 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -2,9 +2,8 @@ name: Build Windows executable on: push: - branches: [ main ] - pull_request: - branches: [ main ] + tags: + - 'v*' jobs: build: @@ -23,7 +22,6 @@ jobs: run: | python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - shell: bash - name: Install PyInstaller run: | @@ -33,8 +31,22 @@ jobs: run: | pyinstaller --onefile bot.py - - name: Upload artifact - uses: actions/upload-artifact@v2 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - name: windows-executable - path: dist/* + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + + - name: Upload Release Asset + id: 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/bot.exe + asset_name: bot.exe + asset_content_type: application/octet-stream diff --git a/xmake.lua b/xmake.lua new file mode 100644 index 0000000..872d947 --- /dev/null +++ b/xmake.lua @@ -0,0 +1,20 @@ +rule("release") + on_run(function (target) + import("core.base.semver") + + -- Get the last git tag + local last_tag = os.iorun("git describe --tags `git rev-list --tags --max-count=1`") + + -- Bump the patch version + local version = semver.new(last_tag:match("^v(.*)")) + version:inc("patch") + + -- Create a new git tag and push it + os.exec("git tag -a v" .. tostring(version) .. " -m \"Release version v" .. tostring(version) .. "\"") + os.exec("git push origin v" .. tostring(version)) + end) + set_menu { + usage = "xmake release", + description = "create a new release", + options = {}, + }