how do i get a version file into an environment variable?

I went down the road that Benjamin W. was talking about with having VERSION in my environment vs just in that specific step.

This worked for me to set the variable in one step, then use it in separate steps.

- name: Set variables
  run: |
    VER=$(cat VERSION)
    echo "VERSION=$VER" >> $GITHUB_ENV

- name: Build Docker Image
  uses: docker/[email protected]
    context: .
    file: ${{ env.BASE_DIR }}/Dockerfile
    load: true
    tags: |
      ${{ env.USER }}/${{ env.REPO }}:${{ env.VERSION }}
      ${{ env.USER }}/${{ env.REPO }}:latest

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top