utils/.github/workflows/build_and_release.yml

42 lines
1.3 KiB
YAML
Raw Normal View History

2022-07-22 15:24:11 -04:00
name: Release
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
2023-03-22 22:27:33 -04:00
- uses: https://github.com/actions/checkout@v2
- uses: https://github.com/actions/setup-python@v4
2022-07-22 15:28:13 -04:00
with:
2023-03-22 22:30:02 -04:00
python-version: '3.11.x'
- name: Install Env
# this should be all we need because shiv will download the deps itself
run: |
2022-07-23 15:26:10 -04:00
pip install --upgrade pip
pip install shiv
pip install poetry
2022-07-23 15:26:10 -04:00
- name: Add CURRENT_TIME env property
2022-07-23 15:36:49 -04:00
run: echo "CURRENT_TIME_VERSION=v$(date '+%s')" >> $GITHUB_ENV
2022-07-23 12:05:34 -04:00
- name: Build the sucker
run: |
2022-07-23 15:27:57 -04:00
sed -i -e "s/?????/${{ env.CURRENT_TIME_VERSION }}/g" src/__init__.py
2022-07-23 12:05:34 -04:00
make build
2023-03-23 19:30:25 -04:00
- name: UPLOAD!
run: |
echo """release_id=$(\
curl -s https://git.joekaufeld.com/api/v1/repos/jkaufeld/utils/releases \
-H "Authorization: token ${{ secrets.PAT }}" \
-d tag_name=${{ env.CURRENT_TIME_VERSION }} \
| python3 -c "import sys, json; print(json.load(sys.stdin)['id'])"\
)""" >> $GITHUB_ENV
curl https://git.joekaufeld.com/api/v1/repos/jkaufeld/utils/releases/${{ env.release_id }}/assets \
-H "Authorization: token ${{ secrets.PAT }}" \
-F attachment=@utils