ci simplified

This commit is contained in:
jem 2021-03-17 08:01:10 +01:00
parent 9d7ab27eb7
commit b30deaba32

View file

@ -17,23 +17,10 @@ services:
- .shadow-cljs/ - .shadow-cljs/
- .m2 - .m2
before_script: before_script:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- npm install - npm install
.cljs-upload-job: &cljs-upload .clj-uploadjob: &clj
image: domaindrivenarchitecture/shadow-cljs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
before_script:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- mkdir -p target/npm-build
- cp target/mastodon-bot.js target/npm-build/
- cp target/mastodon-bot.js.sha256 target/npm-build/
- cp target/mastodon-bot.js.sha512 target/npm-build/
- cp README.md target/npm-build/
.clj-uploadjob: &clj-upload
image: clojure:lein-2.7.1-alpine image: clojure:lein-2.7.1-alpine
cache: cache:
key: ${CI_COMMIT_REF_SLUG} key: ${CI_COMMIT_REF_SLUG}
@ -49,7 +36,7 @@ test-cljs:
- shadow-cljs compile test - shadow-cljs compile test
test-clj: test-clj:
<<: *clj-upload <<: *clj
stage: build_and_test stage: build_and_test
script: script:
- lein test - lein test
@ -68,15 +55,16 @@ package:
<<: *cljs <<: *cljs
stage: package stage: package
script: script:
- mkdir -p target/npm-build
- shadow-cljs release app - shadow-cljs release app
- chmod a+x target/mastodon-bot.js - cp README.md target/npm-build/
- sha256sum target/mastodon-bot.js > target/mastodon-bot.js.sha256 - cp package.json target/npm-build/
- sha512sum target/mastodon-bot.js > target/mastodon-bot.js.sha512 - chmod a+x target/npm-build/mastodon-bot.js
- sha256sum target/npm-build/mastodon-bot.js > target/npm-build/mastodon-bot.js.sha256
- sha512sum targetnpm-build//mastodon-bot.js > target/npm-build/mastodon-bot.js.sha512
artifacts: artifacts:
paths: paths:
- target/mastodon-bot.js - target/npm-build
- target/mastodon-bot.js.sha256
- target/mastodon-bot.js.sha512
sast: sast:
variables: variables:
@ -90,17 +78,16 @@ include:
- template: Security/SAST.gitlab-ci.yml - template: Security/SAST.gitlab-ci.yml
upload-cljs-prerelease: upload-cljs-prerelease:
<<: *cljs-upload <<: *cljs
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/
- sed -i 's|SNAPSHOT|'$(date +"%Y%m%d%H%M%S")'|' ./target/npm-build/package.json - 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
upload-clj-prerelease: upload-clj-prerelease:
<<: *clj-upload <<: *clj
stage: upload stage: upload
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null' - if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
@ -108,12 +95,11 @@ upload-clj-prerelease:
- lein deploy clojars - lein deploy clojars
upload-cljs-release: upload-cljs-release:
<<: *cljs-upload <<: *cljs
stage: upload stage: upload
rules: rules:
- if: '$CI_COMMIT_TAG != null' - if: '$CI_COMMIT_TAG != null'
script: script:
- cp package.json target/npm-build/
- npm publish ./target/npm-build --access public - npm publish ./target/npm-build --access public
image-test-publish: image-test-publish: