From 86a67bd245a7738881e722227333fe9ed11577e8 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Mon, 16 Dec 2019 14:02:17 -0500 Subject: [PATCH] autopublish release and notify in slack --- .gitlab-ci.yml | 60 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 724aa637e..090562de1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,9 +14,17 @@ default: stages: - test - build + - assets - release +.tagged: + rules: + - if: '$CI_COMMIT_TAG =~ /^v[0-9\.]+$/' + when: on_success + + + test:lint: stage: test script: @@ -130,10 +138,10 @@ build:windows: - dist/lbrynet.exe --version + # s3 = upload asset to s3 (build.lbry.io) -# could be done by making it a yaml alias and putting it right into the build step. that way if one OS fails, the others still get uploaded .s3: - stage: release + stage: assets variables: GIT_STRATEGY: none script: @@ -145,42 +153,54 @@ build:windows: s3:linux: extends: .s3 variables: {OS: linux} - dependencies: ["build:linux"] + needs: ["build:linux"] s3:mac: extends: .s3 variables: {OS: mac} - dependencies: ["build:mac"] + needs: ["build:mac"] s3:windows: extends: .s3 variables: {OS: windows} - dependencies: ["build:windows"] + needs: ["build:windows"] -# release = upload assets to github when there's a tagged release -.release: - stage: release - rules: - - if: '$CI_COMMIT_TAG =~ /^v[0-9\.]+$/' - when: on_success + + +# github = upload assets to github when there's a tagged release +.github: + extends: .tagged + stage: assets variables: GIT_STRATEGY: none script: - pip install githubrelease - githubrelease --no-progress --github-token ${GITHUB_CI_USER_ACCESS_TOKEN} asset lbryio/lbry-sdk upload ${CI_COMMIT_TAG} lbrynet-${OS}.zip -release:linux: - extends: .release +github:linux: + extends: .github variables: {OS: linux} - dependencies: ["build:linux"] + needs: ["build:linux"] -release:mac: - extends: .release +github:mac: + extends: .github variables: {OS: mac} - dependencies: ["build:mac"] + needs: ["build:mac"] -release:windows: - extends: .release +github:windows: + extends: .github variables: {OS: windows} - dependencies: ["build:windows"] + needs: ["build:windows"] + + +publish: + extends: .tagged + stage: release + variables: + GIT_STRATEGY: none + script: + - pip install githubrelease + - githubrelease --no-progress --github-token ${GITHUB_CI_USER_ACCESS_TOKEN} release lbryio/lbry-sdk publish ${CI_COMMIT_TAG} + - > + curl -X POST -H 'Content-type: application/json' --data '{"text":" There's a new SDK release: https://github.com/lbryio/lbry-sdk/releases/tag/'"${CI_COMMIT_TAG}"'\n'"$(curl -s "https://api.github.com/repos/lbryio/lbry-sdk/releases/tags/${CI_COMMIT_TAG}" | egrep '\w*\"body\":' | cut -d':' -f 2- | tail -c +3 | head -c -2)"'", "channel":"tech"}' "$(echo ${SLACK_WEBHOOK_URL_BASE64} | base64 -d)" \ No newline at end of file