2021-02-10 14:23:06 +00:00
|
|
|
image: node:lts-buster
|
2021-02-09 19:14:09 +00:00
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
2021-02-10 12:03:38 +00:00
|
|
|
- package
|
|
|
|
- upload
|
2021-02-09 19:14:09 +00:00
|
|
|
|
2021-02-10 11:23:19 +00:00
|
|
|
cache:
|
2021-02-10 12:03:38 +00:00
|
|
|
key: ${CI_COMMIT_REF_SLUG}
|
2021-02-10 11:23:19 +00:00
|
|
|
paths:
|
|
|
|
- node_modules/
|
|
|
|
|
2021-02-10 12:03:38 +00:00
|
|
|
default:
|
|
|
|
before_script:
|
2021-02-10 14:23:06 +00:00
|
|
|
- apt update && apt -qqy install openjdk-11-jre-headless
|
|
|
|
- npm install
|
|
|
|
- npm install -g --save-dev shadow-cljs
|
2021-02-10 12:03:38 +00:00
|
|
|
|
2021-02-09 19:14:09 +00:00
|
|
|
build:
|
|
|
|
stage: test
|
2021-02-10 14:23:06 +00:00
|
|
|
script:
|
2021-02-09 19:14:09 +00:00
|
|
|
- shadow-cljs compile test
|
2021-02-10 12:03:38 +00:00
|
|
|
|
|
|
|
package:
|
|
|
|
stage: package
|
2021-02-10 13:46:24 +00:00
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_BRANCH == "master"'
|
2021-02-10 12:03:38 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2021-02-10 14:23:06 +00:00
|
|
|
- target/
|
|
|
|
script:
|
2021-02-10 12:52:50 +00:00
|
|
|
- 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
|
2021-02-10 12:03:38 +00:00
|
|
|
|
2021-02-10 12:52:50 +00:00
|
|
|
upload-prerelease:
|
|
|
|
stage: upload
|
|
|
|
rules:
|
2021-02-10 13:36:04 +00:00
|
|
|
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
|
2021-02-10 12:52:50 +00:00
|
|
|
before_script:
|
|
|
|
- echo _auth=$NPM_PUBLSH_KEY >> .npmrc
|
|
|
|
- echo email=$NPM_PUBLSH_MAIL >> .npmrc
|
|
|
|
- echo always-auth=true >> .npmrc
|
2021-02-10 14:23:06 +00:00
|
|
|
script:
|
2021-02-10 12:52:50 +00:00
|
|
|
- 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:
|
2021-02-10 13:36:04 +00:00
|
|
|
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG != null'
|
2021-02-10 12:52:50 +00:00
|
|
|
before_script:
|
|
|
|
- echo _auth=$NPM_PUBLSH_KEY >> .npmrc
|
|
|
|
- echo email=$NPM_PUBLSH_MAIL >> .npmrc
|
|
|
|
- echo always-auth=true >> .npmrc
|
2021-02-10 14:23:06 +00:00
|
|
|
script:
|
2021-02-10 12:52:50 +00:00
|
|
|
- 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
|
2021-02-10 13:02:22 +00:00
|
|
|
- npm publish ./target/npm-build/mastodon_bot --access public
|
2021-02-10 14:23:06 +00:00
|
|
|
|
|
|
|
sast:
|
|
|
|
variables:
|
|
|
|
SAST_EXCLUDED_ANALYZERS:
|
|
|
|
bandit, brakeman, flawfinder, gosec, kubesec, phpcs-security-audit,
|
|
|
|
pmd-apex, security-code-scan, sobelow, spotbugs
|
|
|
|
stage: test
|
|
|
|
include:
|
|
|
|
- template: Security/SAST.gitlab-ci.yml
|