This repository has been archived on 2023-07-28. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon-bot/.gitlab-ci.yml
2021-02-10 14:19:49 +01:00

87 lines
2.3 KiB
YAML

image: node:lts-buster
stages:
- test
- package
- upload
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
default:
before_script:
- apt update && apt -qqy install openjdk-11-jre-headless
- npm install
- npm install -g --save-dev shadow-cljs
build:
stage: test
script:
- shadow-cljs compile test
package:
stage: package
artifacts:
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
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 $CI_COMMIT_TAG
- npm publish ./target/npm-build/mastodon_bot --access public
test-prerelease:
stage: test
rules:
- if: $CI_COMMIT_TAG
when: never
- if: '$CI_COMMIT_BRANCH == "master"'
script:
- echo $CI_COMMIT_TAG
test-release:
stage: test
rules:
- if: $CI_COMMIT_TAG
- if: '$CI_COMMIT_BRANCH == "master"'
script:
- echo $