From 2cbb3c20baeb98836f6a4651dee8eb5e11bfb38d Mon Sep 17 00:00:00 2001 From: jem Date: Wed, 10 Feb 2021 13:52:50 +0100 Subject: [PATCH] improved release mgm --- .gitlab-ci.yml | 59 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a543c4d..4c1ccff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,10 +12,7 @@ cache: default: before_script: - - apt update && apt -qqy install openjdk-11-jre-headless - - echo _auth=$NPM_PUBLSH_KEY >> .npmrc - - echo email=$NPM_PUBLSH_MAIL >> .npmrc - - echo always-auth=true >> .npmrc + - apt update && apt -qqy install openjdk-11-jre-headless - npm install - npm install -g --save-dev shadow-cljs @@ -30,20 +27,44 @@ package: paths: - target/ script: - - shadow-cljs compile app - - chmod a+x target/mastodon-bot.js - - sha256sum target/mastodon-bot.js > target/mastodon-bot.js.sha256 - - sha512sum target/mastodon-bot.js > target/mastodon-bot.js.sha512 + - shadow-cljs compile app + - chmod a+x target/mastodon-bot.js + - sha256sum target/mastodon-bot.js > target/mastodon-bot.js.sha256 + - sha512sum target/mastodon-bot.js > target/mastodon-bot.js.sha512 -upload: - stage: upload +upload-prerelease: + stage: upload + rules: + - if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == ""' + before_script: + - echo _auth=$NPM_PUBLSH_KEY >> .npmrc + - echo email=$NPM_PUBLSH_MAIL >> .npmrc + - echo always-auth=true >> .npmrc + script: + - mkdir -p target/npm-build/mastodon_bot + - cp target/mastodon-bot.js target/npm-build/mastodon_bot/ + - cp target/mastodon-bot.js.sha256 target/npm-build/mastodon_bot/ + - cp target/mastodon-bot.js.sha512 target/npm-build/mastodon_bot/ + - cp package.json target/npm-build/mastodon_bot/ + - cp README.md target/npm-build/mastodon_bot/ + - npm version --no-git-tag-version prerelease + - npm publish ./target/npm-build/mastodon_bot --access public + + +upload-release: + stage: upload + rules: + - if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG != ""' + before_script: + - echo _auth=$NPM_PUBLSH_KEY >> .npmrc + - echo email=$NPM_PUBLSH_MAIL >> .npmrc + - echo always-auth=true >> .npmrc script: - - mkdir -p target/npm-build/mastodon_bot - - cp target/mastodon-bot.js target/npm-build/mastodon_bot/ - - cp target/mastodon-bot.js.sha256 target/npm-build/mastodon_bot/ - - cp target/mastodon-bot.js.sha512 target/npm-build/mastodon_bot/ - - cp package.json target/npm-build/mastodon_bot/ - - cp README.md target/npm-build/mastodon_bot/ - #- npm version --no-git-tag-version $(npm view @latest version) - #- npm version --no-git-tag-version prerelease - - npm publish ./target/npm-build/mastodon_bot --access public + - mkdir -p target/npm-build/mastodon_bot + - cp target/mastodon-bot.js target/npm-build/mastodon_bot/ + - cp target/mastodon-bot.js.sha256 target/npm-build/mastodon_bot/ + - cp target/mastodon-bot.js.sha512 target/npm-build/mastodon_bot/ + - cp package.json target/npm-build/mastodon_bot/ + - cp README.md target/npm-build/mastodon_bot/ + - npm version --no-git-tag-version $CI_COMMIT_TAG + - npm publish ./target/npm-build/mastodon_bot --access public \ No newline at end of file