release process should work

This commit is contained in:
jem 2021-03-12 19:01:48 +01:00
parent 187611342c
commit 9138ba5764
5 changed files with 67 additions and 23 deletions

View file

@ -5,24 +5,24 @@ stages:
- upload - upload
.cljs-job: &cljs .cljs-job: &cljs
image: node:lts-buster image: domaindrivenarchitecture/shadow-cljs
cache: cache:
key: ${CI_COMMIT_REF_SLUG} key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- node_modules/ - node_modules/
- .shadow-cljs/ - .shadow-cljs/
- .m2
before_script: before_script:
- apt update && apt -qqy install openjdk-11-jre-headless
- npm install - npm install
- npm install -g shadow-cljs
.js-job: &js-upload .cljs-upload-job: &cljs-upload
image: node:lts-buster image: domaindrivenarchitecture/shadow-cljs
cache: cache:
key: ${CI_COMMIT_REF_SLUG} key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- node_modules/ - node_modules/
- .shadow-cljs/ - .shadow-cljs/
- .m2
before_script: before_script:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- mkdir -p target/npm-build - mkdir -p target/npm-build
@ -31,18 +31,26 @@ stages:
- cp target/k8s-mastodon-bot.js.sha512 target/npm-build/ - cp target/k8s-mastodon-bot.js.sha512 target/npm-build/
- cp README.md target/npm-build/ - cp README.md target/npm-build/
.clj-uploadjob: &clj-upload
image: clojure:lein-2.7.1-alpine
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .m2
before_script:
- echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_PASSWORD}\" }}}}" > ~/.lein/profiles.clj
build_and_test: build_and_test:
<<: *cljs <<: *cljs
stage: build_and_test stage: build_and_test
script: script:
- shadow-cljs compile test - shadow-cljs compile test
#activate as soon as https://github.com/thheller/shadow-cljs/issues/843 is implemented report:
.report:
<<: *cljs <<: *cljs
stage: build_and_test stage: build_and_test
script: script:
- shadow-cljs run shadow.cljs.build-report app target/build-report.html - shadow-cljs run shadow.cljs.build-report frontend target/build-report.html
artifacts: artifacts:
paths: paths:
- target/build-report.html - target/build-report.html
@ -51,7 +59,7 @@ package:
<<: *cljs <<: *cljs
stage: package stage: package
script: script:
- shadow-cljs compile app - shadow-cljs release app
- chmod a+x target/k8s-mastodon-bot.js - chmod a+x target/k8s-mastodon-bot.js
- sha256sum target/k8s-mastodon-bot.js > target/k8s-mastodon-bot.js.sha256 - sha256sum target/k8s-mastodon-bot.js > target/k8s-mastodon-bot.js.sha256
- sha512sum target/k8s-mastodon-bot.js > target/k8s-mastodon-bot.js.sha512 - sha512sum target/k8s-mastodon-bot.js > target/k8s-mastodon-bot.js.sha512
@ -72,23 +80,29 @@ sast:
include: include:
- template: Security/SAST.gitlab-ci.yml - template: Security/SAST.gitlab-ci.yml
upload-prerelease: upload-cljs-prerelease:
<<: *js-upload <<: *cljs-upload
stage: upload stage: upload
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null' - if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
script: script:
- cp package.json target/npm-build/ - cp package.json target/npm-build/
- sed -i 's|SNAPSHOT|'$(date +"%Y%m%d%H%M%S")'|' ./target/npm-build/package.json
- npm publish ./target/npm-build --access public - npm publish ./target/npm-build --access public
# unsure wether that's a good idea to bump versions from ci.
#- npm version prerelease -m "[skip-ci] version bump prerelease version"
#- git push
upload-release: upload-clj-prerelease:
<<: *js-upload <<: *clj-upload
stage: upload stage: upload
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG != null' - if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
script:
- lein deploy clojars
upload-cljs-release:
<<: *cljs-upload
stage: upload
rules:
- if: '$CI_COMMIT_TAG != null'
script: script:
- cp package.json target/npm-build/ - cp package.json target/npm-build/
- npm publish ./target/npm-build --access public - npm publish ./target/npm-build --access public

View file

@ -14,6 +14,12 @@ npm install --ignore-scripts
npx shadow-cljs compile test npx shadow-cljs compile test
``` ```
## create frontend script
```
npx shadow-cljs release frontend
```
## install kubectl ## install kubectl
``` ```

13
doc/Releasing.md Normal file
View file

@ -0,0 +1,13 @@
# stable release (should be done from master)
```
#adjust [version]
vi package.json
lein release
# bump version - increase version and add -SNAPSHOT
vi package.json
git commit -am "version bump"
git push
```

View file

@ -3,10 +3,12 @@
:url "https://www.domaindrivenarchitecture.org" :url "https://www.domaindrivenarchitecture.org"
:license {:name "Apache License, Version 2.0" :license {:name "Apache License, Version 2.0"
:url "https://www.apache.org/licenses/LICENSE-2.0.html"} :url "https://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.10.0"] :dependencies [[org.clojure/clojure "1.10.3"]
[aero "1.1.6"] [aero "1.1.6"]
[orchestra "2021.01.01-1"]
[expound "0.8.9"] [expound "0.8.9"]
[clj-commons/clj-yaml "0.7.106"]] [clj-commons/clj-yaml "0.7.106"]
[dda/mastodon-bot "1.10.10-SNAPSHOT"]]
:source-paths ["src/main/cljc" :source-paths ["src/main/cljc"
"src/main/clj"] "src/main/clj"]
:resource-paths ["src/main/resources"] :resource-paths ["src/main/resources"]
@ -20,6 +22,12 @@
:uberjar {:aot :all :uberjar {:aot :all
:main dda.k8s-mastodon-bot.uberjar :main dda.k8s-mastodon-bot.uberjar
:uberjar-name "k8s-mastodon-bot-standalone.jar" :uberjar-name "k8s-mastodon-bot-standalone.jar"
:dependencies [[org.clojure/tools.cli "1.0.194"] :dependencies [[org.clojure/tools.cli "1.0.206"]
[ch.qos.logback/logback-classic "1.3.0-alpha5"] [ch.qos.logback/logback-classic "1.3.0-alpha5"]
[org.slf4j/jcl-over-slf4j "2.0.0-alpha1"]]}}) [org.slf4j/jcl-over-slf4j "2.0.0-alpha1"]]}}
:release-tasks [["vcs" "assert-committed"]
["change" "version" "leiningen.release/bump-version" "release"]
["vcs" "commit"]
["vcs" "tag"]
["deploy"]
["change" "version" "leiningen.release/bump-version"]])

View file

@ -3,11 +3,14 @@
"src/main/resources" "src/main/resources"
"src/test/cljc"] "src/test/cljc"]
:dependencies [[aero "1.1.6"] :dependencies [[aero "1.1.6"]
[expound "0.8.4"]] [orchestra "2021.01.01-1"]
[expound "0.8.9"]
[dda/mastodon-bot "1.10.10-SNAPSHOT"]]
:dev-http {8080 "public"} :dev-http {8080 "public"}
:builds {:frontend {:target :browser :builds {:frontend {:target :browser
:modules {:main {:init-fn dda.k8s-mastodon-bot.browser/init}} :modules {:main {:init-fn dda.k8s-mastodon-bot.browser/init}}
:release {}} :release {}
:compiler-options {:optimizations :advanced}}
:app {:target :node-script :app {:target :node-script
:output-to "target/k8s-mastodon-bot.js" :output-to "target/k8s-mastodon-bot.js"
:main dda.k8s-mastodon-bot.core/main :main dda.k8s-mastodon-bot.core/main