-
Notifications
You must be signed in to change notification settings - Fork 21
Devops/build updates #1670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Devops/build updates #1670
Changes from all commits
ca4fb75
852c660
3350cde
d1860ed
be2ca53
aeb76b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: 'Create badge' | ||
| description: Create and upload a custom badge | ||
| inputs: | ||
| label: | ||
| type: string | ||
| description: Badge name | ||
| required: true | ||
| status: | ||
| type: string | ||
| description: Status. Pass/Fail, or numeric, Pass will set color to green, Fail to red, anything else is blue. | ||
| required: true | ||
| file: | ||
| type: string | ||
| description: Name of file to create, can include folders | ||
| required: true | ||
| run_id: | ||
| type: number | ||
| description: The value of github.run_id, or another appropriate tracker for downstream use. | ||
| required: true | ||
| outputs: {} | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Badge directory | ||
| shell: bash | ||
| run: mkdir -p "badges/$(dirname '${{inputs.file}}')" || true | ||
| - name: Prepare variables | ||
| id: vars | ||
| shell: bash | ||
| env: | ||
| UNSAFE: ${{ inputs.file }} | ||
| run: | | ||
| # Act, which we use for testing, doesn't yet support case in expression | ||
| # However we may keep this to handle some more complex cases anyways. | ||
| case "${{ inputs.status}}" in | ||
| "Pass") | ||
| echo "color=green" >> $GITHUB_OUTPUT | ||
| ;; | ||
| "Fail") | ||
| echo "color=red" >> $GITHUB_OUTPUT | ||
| ;; | ||
| *) | ||
| echo "color=blue" >> $GITHUB_OUTPUT | ||
| esac | ||
| echo "safe_file=${UNSAFE//\//_}" >> $GITHUB_OUTPUT | ||
| - name: Build Badge | ||
| uses: emibcn/badge-action@v2.0.2 | ||
| with: | ||
| label: ${{inputs.label}} | ||
| status: ${{inputs.status}} | ||
| color: ${{ steps.vars.outputs.color }} | ||
| path: badges/${{inputs.file}} | ||
| - name: Upload badge | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: badges_${{ inputs.run_id }}_${{ steps.vars.outputs.safe_file }} | ||
| path: badges/**/*.svg | ||
| overwrite: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,17 +67,22 @@ jobs: | |
| java-version: '11' | ||
| cache: 'gradle' | ||
| - name: Set version | ||
| if: inputs.nightly == true | ||
| run: echo "VERSION=${{inputs.branch}}-nightly" >> $GITHUB_ENV | ||
| - name: Set version | ||
| if: inputs.nightly == false | ||
| run: echo "VERSION=${{inputs.branch}}" >> $GITHUB_ENV | ||
| id: version | ||
| env: | ||
| NIGHTLY: ${{inputs.nightly}} | ||
| run: | ||
| if [[ "${NIGHTLY}" == true ]]; then | ||
| echo "version=${{inputs.branch}}-nightly" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "version=${{inputs.branch}}" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Sanitize repo for container image names | ||
| id: repo | ||
| run: | | ||
| REPO=`echo "${{github.repository}}" | tr '[:upper:]' '[:lower:]'` | ||
| echo "REPO=$REPO" >> $GITHUB_ENV | ||
| echo "name=$REPO" >> $GITHUB_OUTPUT | ||
| - name: show version | ||
| run: echo ${VERSION} | ||
| run: echo ${{ steps.version.outputs.version }} | ||
| - name: build war | ||
| run: ./gradlew build --info --init-script init.gradle -PversionOverride=$VERSION | ||
| - name: Create GitHub Release | ||
|
|
@@ -86,8 +91,8 @@ jobs: | |
| if: github.event_name != 'pull_request' && (github.event.ref == 'refs/heads/develop' || startsWith(github.event.ref, 'refs/tags')) | ||
| uses: softprops/action-gh-release@v2.6.1 | ||
| with: | ||
| files: cwms-data-api/build/libs/cwms-data-api-${{env.VERSION}}.war | ||
| tag_name: ${{env.VERSION}} | ||
| files: cwms-data-api/build/libs/cwms-data-api-${{steps.version.outputs.version}}.war | ||
| tag_name: ${{steps.version.outputs.version}} | ||
| generate_release_notes: true | ||
| token: ${{ secrets.token != null && secrets.token || secrets.GITHUB_TOKEN }} | ||
| - name: Set up Docker Buildx | ||
|
|
@@ -101,11 +106,11 @@ jobs: | |
| context: git | ||
| images: | | ||
| ${{secrets.registry != null && secrets.registry ||secrets.HEC_PUB_REGISTRY}}/cwms/data-api | ||
| ghcr.io/${{env.REPO}} | ||
| ghcr.io/${{steps.repo.outputs.name}} | ||
| tags: | | ||
| type=sha | ||
| type=ref,event=tag | ||
| type=raw,value=${{env.VERSION}} | ||
| type=raw,value=${{steps.version.outputs.version}} | ||
| type=schedule,pattern=${{inputs.branch}}-{{date 'YYYY.MM.DD'}} | ||
| type=schedule,pattern=${{inputs.branch}}-{{date 'YYYY.MM.DD-hhmmss'}} | ||
| - name: Log in to the Container registry | ||
|
|
@@ -133,6 +138,9 @@ jobs: | |
| labels: ${{ steps.meta.outputs.labels }} | ||
| - name: Set Output Image | ||
| id: set_image | ||
| env: | ||
| REPO: ${{ steps.repo.outputs.name }} | ||
| VERSION: ${{ steps.version.outputs.version }} | ||
| run: | | ||
| echo "api_image=ghcr.io/${REPO}:$VERSION" >> $GITHUB_OUTPUT | ||
| - name: Setup Database Migration Image | ||
|
|
@@ -143,6 +151,9 @@ jobs: | |
| tag: latest-dev | ||
| - name: Publish migration container | ||
| id: migration-publish | ||
| env: | ||
| REPO: ${{ steps.repo.outputs.name }} | ||
| VERSION: ${{ steps.version.outputs.version }} | ||
| run: | | ||
| IMAGE=ghcr.io/${REPO}-schema-migration:$VERSION | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there are some version references still? This might be empty now
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. {REPO} as well
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those are now set in the |
||
| docker tag ${{steps.migration.outputs.image}} $IMAGE | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,3 +12,4 @@ pki/certs | |
| compose.env | ||
| .vscode | ||
| **/node_modules/ | ||
| cwms-data-api/features.properties | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is $REPO coming from I see it removed in other places