Skip to content

TA-511 Fixing branch not set properly #15

TA-511 Fixing branch not set properly

TA-511 Fixing branch not set properly #15

name: Test workflow 2
# Workflow should run on pushes/merged to develop and release branches.
# These two cases should allow to build release and SNAPSHOT artifacts
on:
push:
branches:
- TA-511-output-branch
env:
JAVA_VERSION: 17
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Generate build number
uses: einaregilsson/build-number@v3
with:
token: ${{secrets.ACCESS_TOKEN}}
- name: displaying build number
run: echo "Build number $BUILD_NUMBER started."
check-current-branch:
runs-on: ubuntu-latest
outputs:
cos: ${{ steps.check_branch.outputs.cos }}
cos2: ${{ steps.check_branch.outputs.cos2 }}
BRANCH: ${{ steps.check_branch.outputs.BRANCH }}
BRANCH2: ${{ steps.check_branch.outputs.BRANCH2 }}
steps:
- name: check branch
id: check_branch
shell: bash
run: |
echo "Setting up branch name"
echo "setting branch to: ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
echo "BRANCH2=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT"
echo "cos=1" >> $GITHUB_OUTPUT
echo "cos2=2" >> "$GITHUB_OUTPUT"
echo "test=hello" >> "$GITHUB_OUTPUT"
check-if-branch-is-set:
runs-on: ubuntu-latest
needs:
- check-current-branch
steps:
- name: check branch set
shell: bash
run: |
echo "needs: ${{ toJSON(needs)}}"
echo "branch set in the output is: ${{ needs.check-current-branch.outputs.BRANCH }}"
redeploy-environments2:
runs-on: ubuntu-latest
if: needs.check-current-branch.outputs.BRANCH == 'TA-511-output-branch'
needs:
- check-current-branch
steps:
- name: check branch set
shell: bash
run: |
echo "I Run!"