Skip to content

Commit

Permalink
changed to matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
ywkim312 committed Nov 9, 2023
1 parent bb69b58 commit f256642
Showing 1 changed file with 81 additions and 71 deletions.
152 changes: 81 additions & 71 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,79 +22,89 @@ jobs:
# ----------------------------------------------------------------------
docker:
runs-on: ubuntu-latest
strategy:
fail-fast:
matrix:
name:
- autophrase
include:
- name: autophrase
dockerfile: Dockerfile
workdir: rabbitmq/autophrase
hub_project: socialmediamacroscope/autophrase
steps:
# checkout source code
- uses: actions/checkout@v2

steps:
# checkout source code
- uses: actions/checkout@v2
# calculate some variables that are used later
- name: version information
run: |
if [ "${{ github.event.release.target_commitish }}" != "" ]; then
BRANCH="${{ github.event.release.target_commitish }}"
elif [[ "${{github.event_name}}" == "pull_request" ]]; then
BRANCH="PR-${{github.event.pull_request.number}}"
else
BRANCH=${GITHUB_REF##*/}
fi
echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV
if [ "$BRANCH" == "main" ]; then
VERSION=$(cat manual_jb/content/_config.yml | grep "version" | head -1 | awk -F= "{print $2 }" | sed "s/[[:alpha:]|,|-|\"|:|#|[:space:]]//g" | sed "s/-//g")
VERSIONS="latest"
OLDVERSION=""
TMPVERSION=$VERSION
while [ "$OLDVERSION" != "$TMPVERSION" ]; do
VERSIONS="${VERSIONS} ${TMPVERSION}"
OLDVERSION="${TMPVERSION}"
TMPVERSION=$(echo ${OLDVERSION} | sed 's/\.[0-9]*$//')
done
echo "DOC_VERSION=$VERSION" >> $GITHUB_ENV
echo "DOC_TAGS=${VERSIONS}" >> $GITHUB_ENV

# Swagger API Version
VERSION=$(cat restapi/data.json | grep \"version\" | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,",]//g' | tr -d '[[:space:]]')
VERSIONS="latest"
OLDVERSION=""
TMPVERSION=$VERSION
while [ "$OLDVERSION" != "$TMPVERSION" ]; do
VERSIONS="${VERSIONS} ${TMPVERSION}"
OLDVERSION="${TMPVERSION}"
TMPVERSION=$(echo ${OLDVERSION} | sed 's/\.[0-9]*$//')
done
echo "API_VERSION=${VERSION}" >> $GITHUB_ENV
echo "API_TAGS=${VERSIONS}" >> $GITHUB_ENV
elif [ "$BRANCH" == "develop" ]; then
echo "DOC_VERSION=develop" >> $GITHUB_ENV
echo "API_VERSION=develop" >> $GITHUB_ENV
echo "DOC_TAGS=develop" >> $GITHUB_ENV
echo "API_TAGS=develop" >> $GITHUB_ENV
else
echo "DOC_VERSION=testing" >> $GITHUB_ENV
echo "API_VERSION=testing" >> $GITHUB_ENV
echo "DOC_TAGS=${BRANCH}" >> $GITHUB_ENV
echo "API_TAGS=${BRANCH}" >> $GITHUB_ENV
fi

# calculate some variables that are used later
- name: version information
run: |
if [ "${{ github.event.release.target_commitish }}" != "" ]; then
BRANCH="${{ github.event.release.target_commitish }}"
elif [[ "${{github.event_name}}" == "pull_request" ]]; then
BRANCH="PR-${{github.event.pull_request.number}}"
else
BRANCH=${GITHUB_REF##*/}
fi
echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV
if [ "$BRANCH" == "main" ]; then
VERSION=$(cat manual_jb/content/_config.yml | grep "version" | head -1 | awk -F= "{print $2 }" | sed "s/[[:alpha:]|,|-|\"|:|#|[:space:]]//g" | sed "s/-//g")
VERSIONS="latest"
OLDVERSION=""
TMPVERSION=$VERSION
while [ "$OLDVERSION" != "$TMPVERSION" ]; do
VERSIONS="${VERSIONS} ${TMPVERSION}"
OLDVERSION="${TMPVERSION}"
TMPVERSION=$(echo ${OLDVERSION} | sed 's/\.[0-9]*$//')
done
echo "DOC_VERSION=$VERSION" >> $GITHUB_ENV
echo "DOC_TAGS=${VERSIONS}" >> $GITHUB_ENV
# Swagger API Version
VERSION=$(cat restapi/data.json | grep \"version\" | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,",]//g' | tr -d '[[:space:]]')
VERSIONS="latest"
OLDVERSION=""
TMPVERSION=$VERSION
while [ "$OLDVERSION" != "$TMPVERSION" ]; do
VERSIONS="${VERSIONS} ${TMPVERSION}"
OLDVERSION="${TMPVERSION}"
TMPVERSION=$(echo ${OLDVERSION} | sed 's/\.[0-9]*$//')
done
echo "API_VERSION=${VERSION}" >> $GITHUB_ENV
echo "API_TAGS=${VERSIONS}" >> $GITHUB_ENV
elif [ "$BRANCH" == "develop" ]; then
echo "DOC_VERSION=develop" >> $GITHUB_ENV
echo "API_VERSION=develop" >> $GITHUB_ENV
echo "DOC_TAGS=develop" >> $GITHUB_ENV
echo "API_TAGS=develop" >> $GITHUB_ENV
else
echo "DOC_VERSION=testing" >> $GITHUB_ENV
echo "API_VERSION=testing" >> $GITHUB_ENV
echo "DOC_TAGS=${BRANCH}" >> $GITHUB_ENV
echo "API_TAGS=${BRANCH}" >> $GITHUB_ENV
fi
# build image incore/doc/incore
- name: Build doc image
uses: elgohr/[email protected]
with:
name: socialmediamacroscope/autophrase
no_push: true
workdir: rabbitmq/autophrase
# this will publish to NCSA image incore/doc/incore
# - name: Publish doc image to NCSA Hub
# #if: github.event_name != 'pull_request' && github.repository == env.MAIN_REPO
# if: github.repository == env.MAIN_REPO
# uses: elgohr/[email protected]
# with:
# registry: hub.ncsa.illinois.edu
# name: incore/doc/incore
# username: ${{ secrets.HUB_USERNAME }}
# password: ${{ secrets.HUB_PASSWORD }}
# tags: "${{ env.DOC_TAGS }}"
# workdir: manual_jb
# build image incore/doc/incore
- name: Build doc image
uses: elgohr/[email protected]
with:
dockerfile: ${{ matrix.dockerfile }}
name: ${{ matrix.hub_project }}
no_push: true
workdir: ${{ matrix.workdir }}
# this will publish to NCSA image incore/doc/incore
# - name: Publish doc image to NCSA Hub
# #if: github.event_name != 'pull_request' && github.repository == env.MAIN_REPO
# if: github.repository == env.MAIN_REPO
# uses: elgohr/[email protected]
# with:
# registry: hub.ncsa.illinois.edu
# name: incore/doc/incore
# username: ${{ secrets.HUB_USERNAME }}
# password: ${{ secrets.HUB_PASSWORD }}
# tags: "${{ env.DOC_TAGS }}"
# workdir: manual_jb

#name: Docker
#
Expand Down

0 comments on commit f256642

Please sign in to comment.