Skip to content

Add condition

Add condition #20

name: GitHub Actions Demo
on:
push:
branches:
- 'master'
- 'develop'
- 'hotfix/v*'
- 'release/v*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64]
steps:
- run: echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "πŸ–₯️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
- name: Check branch
run: |
BRANCH_REGEX="^hotfix\/v.*|^release\/v.*"
echo ${{ github.ref }}
echo "${GITHUB_REF_NAME}"
echo ${PRODUCT_VERSION}
if [ "${GITHUB_REF_NAME}" = "develop" ]; then
echo "Branch is ${GITHUB_REF_NAME}"
DERECTORY="io"
fi
if [[ "${GITHUB_REF_NAME} =~ ${BRANCH_REGEX}" ]]; then
echo "GITHUB_REF_NAME = ${GITHUB_REF_NAME}"
DERECTORY="com"
fi
- name: Echo DERECTORY
run: |
echo "DERECTORY IS ${DERECTORY}"