Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ main ]

jobs:
build:
verify:

runs-on: ubuntu-latest

Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: Build Windows executable

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
tags:
- 'v*'

jobs:
build:
Expand All @@ -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: |
Expand All @@ -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
20 changes: 20 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
@@ -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 = {},
}