I'm building a modern WP theme via GCB, and I need a final artifact, a ZIP package. Being new to the GCBб I didn't manage to solve it on my own, but it sounds so obvious
Anyway, here's my final build step
- name: 'gcr.io/cloud-builders/yarn'
args: ['build:production']
I need to create a ZIP archive of the yarn output, recursively including all folder except node_modules, and publish the ZIP as an artifact (this part is clear, and I already got the storage bucket working).
Appreciate the help!
So, hopefully, this answer will help someone. I created a custom build step, a very simple one:
Dockerfile
FROM ubuntu
RUN apt-get -q update && \
apt-get -qqy install zip bzip2 gzip
ENTRYPOINT ["zip"]
cloudbuild.yaml
steps:
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/zip', '.']
images: ['gcr.io/$PROJECT_ID/zip']
And used it this way
- name: gcr.io/$PROJECT_ID/zip
args: ['-r9T', 'theme-$BUILD_ID.zip', '.', '-x *node_modules*']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With