Skip to content

Commit

Permalink
PLANET-5484 Build zip on tag
Browse files Browse the repository at this point in the history
* Same changes as were applied for master theme here greenpeace/planet4-master-theme#1182
  • Loading branch information
Inwerpsel committed Sep 23, 2020
1 parent 2ba0ecd commit 80d597a
Showing 1 changed file with 37 additions and 9 deletions.
46 changes: 37 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ workflows:
context: org-global
- a11y-tests:
context: org-global
- rips-test:
context: rips-scans
- create-release-zip:
context: org-global
filters:
branches:
ignore: /.*/
Expand Down Expand Up @@ -83,7 +83,7 @@ job-references:

commands:
install-instance:
steps:
steps:
- setup_remote_docker:
docker_layer_caching: true
- run:
Expand Down Expand Up @@ -114,7 +114,7 @@ commands:
extract-command:
type: string
steps:
- run:
- run:
name: << parameters.test-name >>
command: << parameters.test-command >>
- run:
Expand Down Expand Up @@ -183,11 +183,39 @@ jobs:
errors=$(jq '.["results"] | .[] | unique_by(.["type"]) | map(select(.["type"] == "error")) | .[]' planet4-docker-compose/artifacts/pa11y/pa11y-ci-results.json)
if [ ! -z "${errors}" ]; then echo "Errors found, see report in artifacts." && exit 1; else echo "No errors, report available in artifacts."; fi
rips-test:
create-release-zip:
docker:
- image: rips/rips-cli:3
environment:
RIPS_APPLICATION_ID: 5
- image: mhart/alpine-node
steps:
- run: apk add curl zip git openssh-client jq python make g++
- checkout
- run: rips-cli -vvv rips:scan:start -a $RIPS_APPLICATION_ID -p ~/project/ -t 1
- run: git submodule init && git submodule update
- run: PUPPETEER_SKIP_DOWNLOAD=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm ci
- run: npm run build
- run:
name: "Remove files we don't want in the zip file."
command: rm -rf .circleci .git .githooks assets/src bin tests
- run: mkdir -p /tmp/workspace/
# Exclude node_modules instead of removing, which takes a long time (lots of small files).
- run:
name: "Create zip file"
command: zip -r /tmp/workspace/planet4-plugin-gutenberg-blocks.zip . -x "node_modules/*"
- run:
name: "Zip file size"
command: ls -lh /tmp/workspace/planet4-plugin-gutenberg-blocks.zip
- run:
name: "Get upload url for this tag"
command: |
curl https://api.github.com/repos/greenpeace/planet4-plugin-gutenberg-blocks/releases/tags/${CIRCLE_TAG} |
jq -r .upload_url |
sed 's/{.*}/?name=planet4-plugin-gutenberg-blocks.zip/' > /tmp/workspace/upload_url
cat /tmp/workspace/upload_url
- run:
name: "Upload zip file"
command: |
curl \
--fail \
-H "Authorization: token ${GITHUB_RELEASES_TOKEN}" \
-H "Content-Type: application/zip" \
--data-binary @/tmp/workspace/planet4-plugin-gutenberg-blocks.zip \
"$(cat /tmp/workspace/upload_url)" | jq

0 comments on commit 80d597a

Please sign in to comment.