diff --git a/.gitea/workflows/default.yaml b/.gitea/workflows/default.yaml index f5dfef0..21c30f1 100644 --- a/.gitea/workflows/default.yaml +++ b/.gitea/workflows/default.yaml @@ -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