37 lines
1003 B
YAML
37 lines
1003 B
YAML
name: tests
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Run unit tests
|
|
run: python3 tests/test_parse.py
|
|
|
|
release:
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
needs: [test]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Create release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
TAG="v$(date -u +%Y%m%d-%H%M%S)"
|
|
API="https://gittheraiwy.theraiwy.top/api/v1/repos/${{ github.repository }}/releases"
|
|
BODY="Automated release from commit ${{ github.sha }}"
|
|
echo "Creating release $TAG ..."
|
|
curl -sS -X POST "$API" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"$BODY\"}" || exit 1
|