45 lines
1.6 KiB
YAML
45 lines
1.6 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@v2
|
|
- uses: https://github.com/actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11.x'
|
|
- name: Install Env
|
|
# this should be all we need because shiv will download the deps itself
|
|
run: |
|
|
pip install --upgrade pip
|
|
pip install shiv
|
|
pip install poetry
|
|
- name: Add CURRENT_TIME env property
|
|
run: echo "CURRENT_TIME_VERSION=v$(date '+%s')" >> $GITHUB_ENV
|
|
- name: Build the sucker
|
|
run: |
|
|
sed -i -e "s/?????/${{ env.CURRENT_TIME_VERSION }}/g" src/__init__.py
|
|
make build
|
|
- name: Create release!
|
|
run: |
|
|
echo """release_id=$(\
|
|
curl -X POST \
|
|
-s https://git.joekaufeld.com/api/v1/repos/${GITHUB_REPOSITORY%/*}/${{ github.event.repository.name }}/releases \
|
|
-H "Authorization: token ${{ secrets.PAT }}" \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"tag_name":"${{ env.CURRENT_TIME_VERSION }}","name":"${{ env.CURRENT_TIME_VERSION }}","body":"it\'s releasin\' time"}' \
|
|
| python3 -c "import sys, json; print(json.load(sys.stdin)['id'])"\
|
|
)""" >> $GITHUB_ENV
|
|
- name: Upload assets!
|
|
run: |
|
|
curl https://git.joekaufeld.com/api/v1/repos/${GITHUB_REPOSITORY%/*}/${{ github.event.repository.name }}/releases/${{ env.release_id }}/assets \
|
|
-H "Authorization: token ${{ secrets.PAT }}" \
|
|
-F attachment=@utils
|