Merge pull request #135 from ibi-group/fix-1.x-scooter-rentals #588
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: OTP CI Build | |
on: | |
push: | |
pull_request: | |
branches: | |
- ibi-dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
MAVEN_OPTS: -Xmx2g | |
steps: | |
# Starting in v2.2 checkout action fetches all tags when fetch-depth=0, for auto-versioning. | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
# Java setup step completes very fast, no need to run in a preconfigured docker container. | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 8 | |
# Retain the local Maven repository to speed up builds. | |
- name: Setup Maven Cache | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ~/.m2 | |
key: maven-local-repo | |
# So that the branch name can be reference via $GITHUB_HEAD_REF_SLUG. | |
- name: Inject slug/short variables | |
uses: rlespinasse/[email protected] | |
# Define AWS profile credentials for use by subsequent steps. | |
- name: Add profile credentials to ~/.aws/credentials | |
if: github.event_name == 'push' | |
run: ./scripts/add-aws-credentials.sh | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
# Build and test deployment. | |
- name: Build and Test | |
run: mvn clean verify --batch-mode --show-version --update-snapshots -Dgpg.skip | |
# Only prepare deploy files on push events to avoid duplicate pushes to s3 when a commit is | |
# pushed to a branch with an open pull request. | |
- name: Prepare build files for deployment to s3 | |
if: github.event_name == 'push' | |
run: ./scripts/prep-build-for-deploy-from-github-actions.sh | |
# Copy build files to AWS. | |
- name: Copy build files to the otp-repo bucket | |
if: github.event_name == 'push' | |
run: | | |
aws s3 cp ./deploy s3://otp-repo --recursive --acl public-read | |
# Install mkdocs using pip for use by subsequent steps. | |
- name: Install mkdocs | |
if: github.event_name == 'push' && env.GITHUB_HEAD_REF_SLUG == 'ibi-dev' | |
run: | | |
pip install mkdocs | |
# Using mkdocs produce docs for deployment. | |
- name: Prepare doc files for deployment to s3 | |
if: github.event_name == 'push' && env.GITHUB_HEAD_REF_SLUG == 'ibi-dev' | |
run: ./scripts/prep-docs-for-deploy-from-github-actions.sh | |
# If on ibi-dev branch, then upload docs to IBI s3 buckets & cloudfront. | |
- name: Upload docs to IBI s3 buckets & cloudfront | |
if: github.event_name == 'push' && env.GITHUB_HEAD_REF_SLUG == 'ibi-dev' | |
run: | | |
aws s3 cp ./target/mkdocs s3://otp-docs.ibi-transit.com --recursive --acl public-read | |
# Push notification to Teams. TODO: Not working. | |
# - name: Notify us of the build status on MS Teams | |
# Release https://github.com/toko-bifrost/ms-teams-deploy-card/releases/tag/3.1.2 this matches | |
# the full length commit SHA below. This must not be changed without first reviewing the code of the newer | |
# version for potential security risks. | |
# uses: toko-bifrost/ms-teams-deploy-card@dcc94e4ce4088b1e6b6de5c9a3cda4ddcbe97d2e | |
# if: always() | |
# with: | |
# github-token: ${{ github.token }} | |
# webhook-uri: ${{ secrets.MSTEAMS_WEBHOOK }} |