create release with curl in workflow
Some checks failed
Build iso when a new version is pushed / test (push) Failing after 6s

This commit is contained in:
2025-04-16 02:16:54 +02:00
parent ca2a2a8e8d
commit 7044d1eebb

View File

@ -17,8 +17,8 @@ jobs:
with:
go-version: '>=1.20.1'
- name: build iso
run: make iso
#- name: build iso
# run: make iso
- name: get commit tag
id: vars
@ -32,11 +32,26 @@ jobs:
git push origin ${{steps.vars.outputs.TAG}}
- name: create release
uses: https://gitea.com/actions/gitea-release-action@main
with:
tag_name: ${{steps.vars.outputs.TAG}}
server_url: https://git.tmoron.fr
name: ${{steps.vars.outputs.TAG}}
files: |-
nixos.iso
api_key: ${{secrets.RELEASE_TOKEN}}
run: |
AUTH_TOKEN=${{secrets.RELEASE_TOKEN}}
TAG_NAME=${{steps.vars.outputs.TAG}}
owner=tom
repo=nix-config
set -e
release_create_res=$(curl -X POST -H "Authorization: token $AUTH_TOKEN" -H "content-type: application/json" -d '{"tag_name":"$TAG_NAME","name":"$TAG_NAME"}' "https://git.tmoron.fr/api/v1/repos/$owner/$repo/releases" 2>/dev/null)
release_id=$(echo $release_create_res | jq -r .id)
echo $release_id
if [ $release_id == "null" ]; then
echo error
exit 1
fi
file_send_res=$(curl \
"https://git.tmoron.fr/api/v1/repos/$owner/$repo/releases/$release_id/assets?name=flake.nix"\
-H "Authorization: token $AUTH_TOKEN"\
-H "accept: application/json"\
-H "Content-Type: multipart/form-data"\
-F "attachment=@flake.nix" 2>/dev/null)
echo $file_send_res