first try for release uploads

This commit is contained in:
jem 2021-03-17 08:59:58 +01:00
parent 50992b6b42
commit 1a8d03c78f
3 changed files with 42 additions and 16 deletions

View file

@ -25,12 +25,18 @@ stages:
before_script: before_script:
- echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_PASSWORD}\" }}}}" > ~/.lein/profiles.clj - echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_PASSWORD}\" }}}}" > ~/.lein/profiles.clj
build_and_test: test-cljs:
<<: *cljs <<: *cljs
stage: build_and_test stage: build_and_test
script: script:
- shadow-cljs compile test - shadow-cljs compile test
test-clj:
<<: *clj
stage: build_and_test
script:
- lein test
report: report:
<<: *cljs <<: *cljs
stage: build_and_test stage: build_and_test
@ -41,19 +47,29 @@ report:
paths: paths:
- target/build-report.html - target/build-report.html
package: package-frontend:
<<: *cljs <<: *cljs
stage: package stage: package
script: script:
- shadow-cljs release app - mkdir -p target/frontend-build
- cp README.md target/npm-build/ - shadow-cljs release frontend
- cp package.json target/npm-build/ - cp public/js/main.js target/frontend-build/k8s-mastodon-bot.js
- chmod a+x target/npm-build/k8s-mastodon-bot.js - sha256sum target/frontend-build/k8s-mastodon-bot.js > target/frontend-build/k8s-mastodon-bot.js.sha256
- sha256sum target/npm-build/k8s-mastodon-bot.js > target/npm-build/k8s-mastodon-bot.js.sha256 - sha512sum target/frontend-build/k8s-mastodon-bot.js > target/frontend-build/k8s-mastodon-bot.js.sha512
- sha512sum target/npm-build/k8s-mastodon-bot.js > target/npm-build/k8s-mastodon-bot.js.sha512
artifacts: artifacts:
paths: paths:
- target/npm-build - target/frontend-build
package-uberjar:
<<: *clj
stage: package
script:
- lein uberjar
- sha256sum target/uberjar/k8s-mastodon-bot-standalone.jar > target/uberjar/k8s-mastodon-bot-standalone.jar.sha256
- sha512sum target/uberjar/k8s-mastodon-bot-standalone.jar > target/uberjar/k8s-mastodon-bot-standalone.jar.sha512
artifacts:
paths:
- target/uberjar
sast: sast:
variables: variables:
@ -83,10 +99,23 @@ upload-clj-prerelease:
script: script:
- lein deploy clojars - lein deploy clojars
upload-cljs-release: release:
<<: *cljs # Caution, as of 2021-02-02 these assets links require a login, see:
# https://gitlab.com/gitlab-org/gitlab/-/issues/299384
image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: upload stage: upload
rules: rules:
- if: '$CI_COMMIT_TAG != null' - if: '$CI_COMMIT_TAG != null'
variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic"
UBERJAR_URL: "${PACKAGE_REGISTRY_URL}/k8s-mastodon-bot-standalone/${$CI_COMMIT_TAG}/k8s-mastodon-bot-standalone.jar"
FRONTEND_URL: "${PACKAGE_REGISTRY_URL}/k8s-mastodon-bot/${$CI_COMMIT_TAG}/k8s-mastodon-bot.js"
script: script:
- npm publish ./target/npm-build --access public - |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file target/uberjar/k8s-mastodon-bot-standalone.jar ${UBERJAR_URL}
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file target/frontend-build/k8s-mastodon-bot.js ${FRONTEND_URL}
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"k8s-mastodon-bot-standalone.jar\",\"url\":\"${UBERJAR_URL}\"}" \
--assets-link "{\"name\":\"k8s-mastodon-bot.js\",\"url\":\"${FRONTEND_URL}\"}"

View file

@ -9,6 +9,7 @@
[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"]] [dda/mastodon-bot "1.10.10-SNAPSHOT"]]
:target-path "target/%s/"
: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"]

View file

@ -11,10 +11,6 @@
: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}} :compiler-options {:optimizations :advanced}}
:app {:target :node-script
:output-to "target/npm-build/k8s-mastodon-bot.js"
:main dda.k8s-mastodon-bot.core/main
:compiler-options {:optimizations :simple}}
:test {:target :node-test :test {:target :node-test
:output-to "target/node-tests.js" :output-to "target/node-tests.js"
:autorun true :autorun true