From 37a66a82ef35275118cc17a1fa7b3e26f6b8a0d1 Mon Sep 17 00:00:00 2001 From: El Acheche ANIS Date: Fri, 20 Dec 2019 22:56:29 +0100 Subject: [PATCH] Create main.yml Github actions workflow to upload releases asset --- .github/workflows/main.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..0aefcca --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,20 @@ +name: Upload asset + +on: + release: + types: [published] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Run a multi-line script + run: | + LATEST=$(curl -s https://api.github.com/repos/elacheche/docker_check/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) ".tar.gz"}') + curl -Lso $LATEST https://github.com/elacheche/docker_check/archive/$LATEST + tar xzf $LATEST + FILE=$(ls docker_check*/docker_check.py) + UPLOAD_URL=$(curl -s https://api.github.com/repos/elacheche/docker_check/releases/latest | awk '/upload_url/ {gsub("\"","");gsub(",","");gsub("{.*}","");print $2"?name=docker_check________.py"}') + curl -s -H "Authorization: token $UPLOAD_ASSETS" -H "Content-Type: $(file -b --mime-type $FILE)" --data-binary @$FILE $UPLOAD_URL