0

I am studying to automate the build and deployment of my google app engine application in Travis, so far it allows me to have static or predefined version name during deployment in .travis.yml.

Is there any way to make it dynamically generated at runtime? Like for example below in my .travis.yml file, I have deployment for production and staging version of the application, both are named or labeled as production and qa-staging, and I would like to suffix the version names with a timestamp or anything as long as it would be unique every successful build and deployment.

language: node_js
node_js:
- "10"

before_install:
- openssl aes-256-cbc -K $encrypted_c423808ed406_key -iv $encrypted_c423808ed406_iv
  -in gae-creds.json.enc -out gae-creds.json -d
- chmod +x test.sh
- cat gae-creds.json

install:
- npm install

script:
- "./test.sh"

deploy:
  - provider: gae
    skip_cleanup: true
    keyfile: gae-creds.json
    project: traviscicd
    no_promote: true
    version: qa-staging
    on:
      branch: staging
  - provider: gae
    skip_cleanup: true
    keyfile: gae-creds.json
    project: traviscicd
    version: production
    on:
      branch: master
Ariel Magbanua
  • 3,083
  • 7
  • 37
  • 48

2 Answers2

0

Have you tried with https://yaml.org/type/timestamp.html ?

Im not sure if the context is the correct but seems a good and elegant option for your yaml file.

Mario
  • 406
  • 2
  • 6
0

Perhaps you can use go generate to generate a version string that can be included? You need to run go generate as part of the build process for it to work, though.

nafmo
  • 448
  • 4
  • 19