Trying to add an time stamp or custom variable to s3 deploy step

#1

I am trying to upload my builds to the s3 bucket with a time stamp, not with a bitrise time stamp. After my IPA generated. I have added a custom shell script where I defined my timestamp variable.
set -e
timestamp=$(date “+%h-%d-%y:%H:%M”)
echo $timestamp
set -x
In the next step, I selected Deploy to Amazon s3 bucket. where I added the timestamp variable. but timestamp value is not assigning.

0 Likes

#2

Hello @motoki-kawakami

the problem with this is the normal key=value setup only works in one terminal session, you should define env vars to hold up in the whole build with envman like this

envman add --key timestamp --value $(date “+%h-%d-%y:%H:%M”)

and like this the next step can use the env var as you would want it to be :upside_down_face:

1 Like

#3

I added this line in the script step: envman add --key timestamp --value $(date “+%h-%d-%y:%H:%M”)
It says illegal time format.

date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] …
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
Incorrect Usage: flag needs an argument: -value

what time format will it take?

0 Likes

#4

Hy👋

this one works for me -> envman add --key time --value $(date +%h-%d-%m-%y:%H:%M)

0 Likes