From 71ad1534c563c6f08273c8c5fc2977bb74f5fd94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20CHABANNE?= Date: Sun, 9 Jun 2024 01:45:45 +0200 Subject: [PATCH] Test upload releasegithub --- .gitea/workflows/actions.yaml | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/actions.yaml b/.gitea/workflows/actions.yaml index 962998b..d4b2c37 100644 --- a/.gitea/workflows/actions.yaml +++ b/.gitea/workflows/actions.yaml @@ -20,21 +20,49 @@ jobs: - name: Install dependencies run: | apt update - apt install tree zip wget -y + apt install tree zip wget jq -y - name: List files in the repository run: tree ${{ gitea.workspace }} - name: Build run : | echo "Compilation step in progress" - zip -rv go2ticket-chrome.zip src/* - cp go2ticket-chrome.zip go2ticket-firefox.xpi + zip -rv go2ticket-firefox.zip src/* + cp go2ticket-firefox.zip go2ticket-firefox.xpi wget https://github.com/mcuadros/go-crxmake/releases/download/v0.2.0/crxmake_v0.2.0_linux_amd64.tar.gz tar -xvzf crxmake_v0.2.0_linux_amd64.tar.gz crxmake_v0.2.0_linux_amd64/crxmake ./crxmake_v0.2.0_linux_amd64/crxmake src/ go2ticket-chrome.crx ls -l go2ticket-* - name: Deploy release if: ${{ gitea.ref == 'refs/heads/master' }} + id: create_release run: | echo "Deploy artifacts on Gitea server" + curl -X POST -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{ + "tag_name": "${{ gitea.ref }}", + "target_commitish": "${{ gitea.sha }}", + "name": "${{ gitea.ref }}", + "body": "Release description", + "draft": true, + "prerelease": false + }' \ + "${{ vars.GIT_URL }}/api/v1/repos/${{ gitea.repository }}/releases" + + RELEASE_ID=$(curl -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \ + -H "Content-Type: application/json" \ + "${{ vars.GIT_URL }}/api/v1/repos/${{ gitea.repository }}/releases/tags/${{ gitea.ref }}" \ + | jq '.id') + + curl -X POST -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \ + -H "Content-Type: multipart/form-data" \ + -F "attachment=@go2ticket-firefox.xpi" \ + "${{ vars.GIT_URL }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets" + + curl -X POST -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \ + -H "Content-Type: multipart/form-data" \ + -F "attachment=@go2ticket-chrome.crx" \ + "${{ vars.GIT_URL }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets" + - name: Job's status run: echo "🍏 This job's status is ${{ job.status }}."