Skip to content

Merge master branch into 4.x release branch #856

Merge master branch into 4.x release branch

Merge master branch into 4.x release branch #856

Workflow file for this run

name: Provisioning App Build
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install NPM
run: cd client && npm install
- name: Build provisioning-app FE
run: cd client && npm run build:prod
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt' # See 'Supported distributions' for available options
java-version: '11'
- name: Build provisioning-app BE (copy the FE artifacts to 'build/resources/main/static/nfe')
run: ./gradlew clean spotlessCheck build
env:
NO_NEXUS: true
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build docker image
if: success()
run: |
COMMIT_SHA=$(git show --format="%H" --no-patch)
COMMIT_AUTHOR=$(git --no-pager show -s --format='%an (%ae)' $COMMIT_SHA)
COMMIT_MESSAGE=$(git log -1 --pretty=%B $COMMIT_SHA)
COMMIT_TIME=$(git show -s --format=%ci $COMMIT_SHA)
BUILD_TIME=$(date -u "+%Y-%m-%d %H:%M:%S %z")
echo "GITHUB_REF=$GITHUB_REF" \
echo "COMMIT_AUTHOR=$COMMIT_AUTHOR" \
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" \
echo "COMMIT_SHA=$COMMIT_SHA" \
echo "GITHUB_SHA=$GITHUB_SHA" \
echo "COMMIT_TIME=$COMMIT_TIME" \
echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" \
echo "BUILD_TIME=$BUILD_TIME"
docker build \
--label "ods.build.job.url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
--label "ods.build.source.repo.ref=$GITHUB_REF" \
--label "ods.build.source.repo.commit.author=$COMMIT_AUTHOR" \
--label "ods.build.source.repo.commit.msg=$COMMIT_MESSAGE" \
--label "ods.build.source.repo.commit.sha=$COMMIT_SHA" \
--label "ods.build.source.repo.commit.timestamp=$COMMIT_TIME" \
--label "ods.build.source.repo.url=https://github.com/$GITHUB_REPOSITORY.git" \
--label "ods.build.timestamp=$BUILD_TIME" \
-t ods-provisioning-app:local .
docker inspect ods-provisioning-app:local --format='{{.Config.Labels}}'
working-directory: docker
- name: Push docker image
if: success() && github.repository == 'opendevstack/ods-provisioning-app' && github.event_name == 'push'
shell: bash
env:
DOCKER_USER: ${{ secrets.DockerHubUser }}
DOCKER_PASS: ${{ secrets.DockerHubPass }}
run: ./.github/workflows/push-image.sh ${{ github.ref }} "$DOCKER_USER" "$DOCKER_PASS"