From e1aa3e17534e598e05aa85b6ea7750eec8e30fef Mon Sep 17 00:00:00 2001 From: MuratovAS Date: Mon, 16 Jan 2023 00:33:13 +0500 Subject: [PATCH] add ci/cd --- .github/workflows/main-push.yml | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/main-push.yml diff --git a/.github/workflows/main-push.yml b/.github/workflows/main-push.yml new file mode 100644 index 0000000..e7aad1f --- /dev/null +++ b/.github/workflows/main-push.yml @@ -0,0 +1,38 @@ +on: + push: + branches: [ master ] + +jobs: + run: + name: Build project + strategy: + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install toolchain + run: sudo apt update && sudo apt install maven + - name: Build project + run: | + perl -0777 -pe 's{\s*.*?}{ ($a = $&) !~ /launch4j-maven-plugin/ && $a || "" }gse' pom.xml > pom_new.xml && mv pom_new.xml pom.xml + mvn clean package + - name: publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd target + RELEASE_FILE="verilog-format-1.0.1-full.jar" + RELEASE_NAME="verilog-format.jar" + RELEASE_TAG="$(date +%y%m%d)" + curl -sL -XPOST -d '{"tag_name": "'$RELEASE_TAG'"}' \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H 'Content-Type: application/json' \ + "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases" + RELEASE_ID=$(curl -svL https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$RELEASE_TAG | jq .id) + curl -sL -XPOST -T ${RELEASE_FILE}* \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type:application/octet-stream" \ + "https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/$RELEASE_ID/assets?&name=$RELEASE_NAME" + shell: bash