CTO-118 Updated Gate Change Controller and DAO #2120
Workflow file for this run
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 CWMS Data API | |
on: | |
push: | |
branches: | |
- develop | |
- 'release/**' | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build: | |
name: build and test | |
runs-on: ubuntu-latest | |
outputs: | |
thewar: ${{steps.thebuild.outputs.WARFILE}} | |
steps: | |
- name: checkout code | |
uses: actions/[email protected] | |
- name: setup java | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '8' | |
cache: 'gradle' | |
- name: build and test | |
id: thebuild | |
run: ./gradlew build --info --init-script init.gradle | |
- name: Upload WAR | |
uses: actions/[email protected] | |
with: | |
name: warfile | |
path: cwms-data-api/build/libs/${{steps.thebuild.outputs.WARFILE}} | |
retention-days: 1 | |
if-no-files-found: error | |
- name: Build docker image | |
run: docker build -t cda:build-latest . | |
release: | |
if: github.event_name == 'push' && startsWith(github.ref,'refs/heads/release') | |
name: Create and push releases | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/[email protected] | |
- name: setup java | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '8' | |
cache: 'gradle' | |
- name: Download all workflow run artifacts from build | |
id: artifacts | |
uses: actions/[email protected] | |
with: | |
path: ./ | |
- name: get version | |
id: get_version | |
run: .github/workflows/get_version.sh | |
- name: show version | |
run: echo ${VERSION} | |
- name: Create Release | |
id: create_release | |
uses: softprops/[email protected] | |
with: | |
files: warfile/${{ needs.build.outputs.thewar}} | |
tag_name: ${{env.VERSION}} | |
generate_release_notes: true | |
- name: Login to Alt Registry | |
uses: docker/[email protected] | |
id: login-alt | |
with: | |
registry: ${{ secrets.ALT_REGISTRY }} | |
username: ${{ secrets.ALT_REG_USER }} | |
password: ${{ secrets.ALT_REG_PASSWORD }} | |
- name: Build docker image | |
env: | |
IMAGE_TAG: ${{env.VERSION}} | |
ALT_REGISTRY: ${{secrets.ALT_REGISTRY}} | |
run: | | |
docker build -t cda:build-latest . | |
docker tag cda:build-latest $ALT_REGISTRY/cwms/data-api:$IMAGE_TAG | |
docker tag cda:build-latest $ALT_REGISTRY/cwms/data-api:latest | |
docker push $ALT_REGISTRY/cwms/data-api:$IMAGE_TAG | |
docker push $ALT_REGISTRY/cwms/data-api:latest | |
- name: Logout of ALT registry | |
if: ${{ always() }} | |
run: docker logout ${{ steps.login-alt.outputs.registry }} |