autopublish release and notify in slack

This commit is contained in:
Alex Grintsvayg 2019-12-16 14:02:17 -05:00
parent 099b0b65c0
commit 86a67bd245
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5

View file

@ -14,9 +14,17 @@ default:
stages: stages:
- test - test
- build - build
- assets
- release - release
.tagged:
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9\.]+$/'
when: on_success
test:lint: test:lint:
stage: test stage: test
script: script:
@ -130,10 +138,10 @@ build:windows:
- dist/lbrynet.exe --version - dist/lbrynet.exe --version
# s3 = upload asset to s3 (build.lbry.io) # 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: .s3:
stage: release stage: assets
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
script: script:
@ -145,42 +153,54 @@ build:windows:
s3:linux: s3:linux:
extends: .s3 extends: .s3
variables: {OS: linux} variables: {OS: linux}
dependencies: ["build:linux"] needs: ["build:linux"]
s3:mac: s3:mac:
extends: .s3 extends: .s3
variables: {OS: mac} variables: {OS: mac}
dependencies: ["build:mac"] needs: ["build:mac"]
s3:windows: s3:windows:
extends: .s3 extends: .s3
variables: {OS: windows} variables: {OS: windows}
dependencies: ["build:windows"] needs: ["build:windows"]
# release = upload assets to github when there's a tagged release
.release:
stage: release # github = upload assets to github when there's a tagged release
rules: .github:
- if: '$CI_COMMIT_TAG =~ /^v[0-9\.]+$/' extends: .tagged
when: on_success stage: assets
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
script: script:
- pip install githubrelease - pip install githubrelease
- githubrelease --no-progress --github-token ${GITHUB_CI_USER_ACCESS_TOKEN} asset lbryio/lbry-sdk upload ${CI_COMMIT_TAG} lbrynet-${OS}.zip - githubrelease --no-progress --github-token ${GITHUB_CI_USER_ACCESS_TOKEN} asset lbryio/lbry-sdk upload ${CI_COMMIT_TAG} lbrynet-${OS}.zip
release:linux: github:linux:
extends: .release extends: .github
variables: {OS: linux} variables: {OS: linux}
dependencies: ["build:linux"] needs: ["build:linux"]
release:mac: github:mac:
extends: .release extends: .github
variables: {OS: mac} variables: {OS: mac}
dependencies: ["build:mac"] needs: ["build:mac"]
release:windows: github:windows:
extends: .release extends: .github
variables: {OS: windows} 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":"<!channel> 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)"