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