diff --git a/.circleci/config.yml b/.circleci/config.yml index 2309fa4..923c0fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,18 +2,6 @@ # # Check https://circleci.com/docs/2.0/language-javascript/ for more details # -aliases: - # Workflow filters - - &filter-not-release-or-master - tags: - ignore: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ - branches: - ignore: - - master - - &filter-only-master - branches: - only: master - version: 2 jobs: build: @@ -27,6 +15,11 @@ jobs: - dependency-cache-{{ checksum "yarn.lock" }} # fallback to using the latest cache if no exact match is found - dependency-cache- + - run: + name: Setup Environment Variables + command: | + echo "export GIT_SHA1=$(echo ${CIRCLE_SHA1} | cut -c -7)" >> $BASH_ENV + source $BASH_ENV - run: name: yarn install command: 'yarn install --pure-lockfile --no-progress' @@ -35,6 +28,54 @@ jobs: - node_modules key: dependency-cache-{{ checksum "yarn.lock" }} - run: yarn lint - - run: yarn build + - run: yarn test + - run: + name: Create directories for Artifacts + command: mkdir -p ~/artifacts/scalyr_plugin/target/ + - run: + name: Build artifacts + command: | + yarn build + cp -rf dist/ ~/artifacts/scalyr_plugin/ + echo Plugin git sha is ${GIT_SHA1} + cd ~/artifacts/scalyr_plugin/ && tar -czvf scalyr_grafana_plugin_${GIT_SHA1}.tar.gz dist/ && mv scalyr_grafana_plugin_${GIT_SHA1}.tar.gz target/ + - persist_to_workspace: + root: ~/artifacts/scalyr_plugin/target/ + paths: + - scalyr_grafana_plugin_*.tar.gz + - store_artifacts: + path: ~/artifacts/scalyr_plugin/target/ + destination: scalyr_grafana_plugin + + deploy-to-github-releases: + docker: + - image: circleci/golang:1.12 + steps: + - attach_workspace: + at: ~/artifacts/scalyr_plugin/ + - run: + name: "Publish Release on GitHub" + command: | + go get github.com/tcnksm/ghr + VERSION=${CIRCLE_TAG} + echo Releasing version $VERSION + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} /home/circleci/artifacts/scalyr_plugin/ + +workflows: + version: 2 + build-and-deploy: + jobs: + - build: + filters: + tags: + only: /.*/ -# TODO: Ship dist/ folder to github releases and tag them + - deploy-to-github-releases: + requires: + - build + filters: + branches: + ignore: /.*/ + tags: + # See https://discuss.circleci.com/t/filter-job-by-tag-not-working-regexp-possibly-unsupported/28484 + only: /^(\d|[1-9]\d*)\.(\d|[1-9]\d*)\.(\d|[1-9]\d*)(-(0|[1-9A-Za-z-][0-9A-Za-z-]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\.(0|[1-9A-Za-z-][0-9A-Za-z-]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5f5ff18 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## In Development + +## 1.0.0 + +Initial release diff --git a/HOW_TO_CONTRIBUTE.md b/HOW_TO_CONTRIBUTE.md index 7b433e4..a76763b 100644 --- a/HOW_TO_CONTRIBUTE.md +++ b/HOW_TO_CONTRIBUTE.md @@ -9,6 +9,9 @@ We welcome and appreciate contributions of any kind (code, tests, documentation, and use appropriate labels to indicate the kind of issue. * Please fork this repo and create a branch to make your changes * Please include the issues you are fixing in the commits +* Please add an entry in [CHANGELOG.md](./CHANGELOG.md) in `In Development` section along with + github issue number and author information. For example: + `Power queries now support blah (#1234) (Alice Wonderland)` ## Plugin development diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000..f6cfe70 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,17 @@ +# Maintainers Documentation + +## Release checklist + +* Please make sure CHANGELOG reflects the new version to be released + (Usually, that's changing the `In Development` items to be reflected under + new version and leaving `In Development` empty) +* Set the new version to be released in plugin.json and package.json +* Please push a tag using git commands + + ```bash + git tag -a 0.1.0 -m "0.1.0 - Shiny new features and bug fixes" + git push upstream 0.1.0 + ``` + +* Circle CI builds the tag and ships to github releases +* Please ensure the released tar.gz contains the `dist` folder