|
42 | 42 | - name: Get release version |
43 | 43 | if: github.event_name == 'release' |
44 | 44 | id: get_release_version |
45 | | - run: echo ::set-output name=VERSION::$(echo ${{ github.event.release.tag_name }} | grep -E "^[0-9]+.[0-9]+(-rc[0-9]+)?$" | cut -f 1,2 -d . | cut -f 1 -d -) |
| 45 | + run: echo ::set-output name=VERSION::$(echo ${{ github.event.release.tag_name }} | awk -F '[.-]' '/^[0-9]+.[0-9]+[.0-9]*(-rc[0-9]+)?$/ {print $1 "." $2}') |
46 | 46 |
|
47 | 47 | - name: Set image version and force image action for release |
48 | 48 | if: github.event_name == 'release' && steps.get_release_version.outputs.VERSION != '' |
|
51 | 51 | echo "FORCE_IMAGE_ACTION=rebuild" >> $GITHUB_ENV |
52 | 52 |
|
53 | 53 | - name: Set image version and force image action for stable branch |
54 | | - if: startsWith(github.ref, 'refs/heads/stable-') |
| 54 | + # we want to set IMG_VER to e.g. '1.x' for stable branches and PRs against them |
| 55 | + # for PRs we have to use 'base_ref' - this is the target branch (and we have to check that instead) |
| 56 | + if: |
| 57 | + startsWith(github.ref, 'refs/heads/stable-') || startsWith(github.base_ref, 'stable-') |
| 58 | + # we now know we're on (or against) stable branches, so we just need to pick the version (e.g. the mentioned '1.x') |
55 | 59 | run: | |
56 | | - echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV |
| 60 | + IMG_VER=$(echo ${GITHUB_BASE_REF} | cut -d - -f 2) |
| 61 | + [ -z "${IMG_VER}" ] \ |
| 62 | + && echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV \ |
| 63 | + || echo "IMG_VER=${IMG_VER}" >> $GITHUB_ENV |
57 | 64 | echo "FORCE_IMAGE_ACTION=rebuild" >> $GITHUB_ENV |
58 | 65 |
|
59 | 66 | - name: Clone the git repo |
|
67 | 74 |
|
68 | 75 | - name: Run the build |
69 | 76 | run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh |
| 77 | + |
70 | 78 | doc: |
71 | 79 | name: build and publish docs |
72 | 80 | runs-on: ubuntu-latest |
|
82 | 90 | matrix: |
83 | 91 | CONFIG: ["TYPE=doc OS=fedora OS_VER=32"] |
84 | 92 | steps: |
| 93 | + - name: Set image version for stable branch |
| 94 | + # doc update happens only on stable branch (not on PR), so we check only for heads ref |
| 95 | + if: startsWith(github.ref, 'refs/heads/stable-') |
| 96 | + run: | |
| 97 | + echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV |
| 98 | +
|
85 | 99 | - name: Clone the git repo |
86 | 100 | uses: actions/checkout@v2 |
87 | 101 | with: |
|
0 commit comments