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:
- echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_PASSWORD}\" }}}}" > ~/.lein/profiles.clj
build_and_test:
test-cljs:
<<: *cljs
stage: build_and_test
script:
- shadow-cljs compile test
test-clj:
<<: *clj
stage: build_and_test
script:
- lein test
report:
<<: *cljs
stage: build_and_test
@ -41,19 +47,29 @@ report:
paths:
- target/build-report.html
package:
package-frontend:
<<: *cljs
stage: package
script:
- shadow-cljs release app
- cp README.md target/npm-build/
- cp package.json target/npm-build/
- chmod a+x target/npm-build/k8s-mastodon-bot.js
- sha256sum target/npm-build/k8s-mastodon-bot.js > target/npm-build/k8s-mastodon-bot.js.sha256
- sha512sum target/npm-build/k8s-mastodon-bot.js > target/npm-build/k8s-mastodon-bot.js.sha512
- mkdir -p target/frontend-build
- shadow-cljs release frontend
- cp public/js/main.js target/frontend-build/k8s-mastodon-bot.js
- sha256sum target/frontend-build/k8s-mastodon-bot.js > target/frontend-build/k8s-mastodon-bot.js.sha256
- sha512sum target/frontend-build/k8s-mastodon-bot.js > target/frontend-build/k8s-mastodon-bot.js.sha512
artifacts:
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:
variables:
@ -83,10 +99,23 @@ upload-clj-prerelease:
script:
- lein deploy clojars
upload-cljs-release:
<<: *cljs
release:
# 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
rules:
- 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:
- 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"]
[clj-commons/clj-yaml "0.7.106"]
[dda/mastodon-bot "1.10.10-SNAPSHOT"]]
:target-path "target/%s/"
:source-paths ["src/main/cljc"
"src/main/clj"]
:resource-paths ["src/main/resources"]

View file

@ -11,10 +11,6 @@
:modules {:main {:init-fn dda.k8s-mastodon-bot.browser/init}}
:release {}
: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
:output-to "target/node-tests.js"
:autorun true