name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Get version from tag
id: version
run: |
# Remove 'v' prefix from tag
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Get build info
id: build_info
run: |
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "time=$(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> $GITHUB_OUTPUT
- name: Build xd.pyz
env:
XD_VERSION: ${{ steps.version.outputs.version }}
XD_BUILD_TIME: ${{ steps.build_info.outputs.time }}
XD_BUILD_COMMIT: ${{ steps.build_info.outputs.commit }}
run: ./scripts/build-pyz.sh
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: xd.pyz
generate_release_notes: true
body: |
## Installation
```bash
curl -L https://github.com/cncsmonster/xdotter/releases/latest/download/xd.pyz -o ~/.local/bin/xd
chmod +x ~/.local/bin/xd
xd --help
```
## Build Info
- **Version**: ${{ steps.version.outputs.version }}
- **Commit**: ${{ steps.build_info.outputs.commit }}
- **Built**: ${{ steps.build_info.outputs.time }}
## Changelog
See [CHANGELOG.md](https://github.com/cncsmonster/xdotter/blob/main/CHANGELOG.md) for details.