How to use dynamic variable in artifact path?

Hi,

I’m trying to save artifact with its version number, which is dynamic. Here is what I have came up with so far:

variables:
  PROJECT_NAME: foo

build:
  image: docker-something
  stage: build
  before_script:
    - export RELEASE_VERSION=$(sed -n '/version:."*"/p' mix.exs|sed 's/[a-z:", \n\t*]//g' | tr -d '\n')
  variables:
    MIX_ENV: prod
  script:
    - mix release
  when: on_success
  artifacts:
    paths:
      - "_build/prod/rel/$PROJECT_NAME/releases/$RELEASE_VERSION/$PROJECT_NAME.tar.gz"

That gives an error

Uploading artifacts...
WARNING: _build/prod/rel/foo/releases//foo.tar.gz: no matching files 
1 Like