#3265 Add version and build hash to git pipeline and config json #686
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches-ignore: | |
- development | |
- test | |
- master | |
paths-ignore: | |
- 'docs/**' | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 15 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: 15 | |
- name: Cache maven artifacts | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-maven-artifacts | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} | |
- name: Install MDM Maven plugin | |
shell: bash | |
run: mvn -f maven-plugin/pom.xml install | |
- name: Set up node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('mdm-frontend/package-lock.json') }} | |
- name: Extract branch name | |
shell: bash | |
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | |
- name: Build with Maven | |
run: ./deploy/build.sh unused ${{ env.BRANCH }} | |
env: | |
REPO_GITHUB_USERNAME: ${{ secrets.REPO_GITHUB_USERNAME }} | |
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} | |
- name: Report build status via Slack | |
uses: act10ns/slack@v2 | |
if: always() | |
with: | |
status: ${{ job.status }} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
- name: Build commit hash | |
run: | | |
export BUILD_COMMIT_HASH=$(git rev-parse HEAD) | |
ls | |
pwd | |
ls ../../mdm-frontend/src/assets | |
echo $BUILD_COMMIT_HASH | |
# sed -i "s/\"buildHash\": \".*\"/\"buildHash\": \"$BUILD_COMMIT_HASH\"/" ../../mdm-frontend/src/assets/config.json |