Skip to content

Lint main

Lint main #32

Workflow file for this run

name: Build 'n Deploy
on:
push:
branches:
- '*'
tags-ignore:
- '*'
paths-ignore:
- 'build.gradle'
- 'bumpver.toml'
jobs:
build-api:
name: build, lint, and test API
runs-on: ubuntu-latest
steps:
# -- Setup --
- uses: getsentry/action-github-app-token@v1
name: my-app-install token
id: podaac-cicd
with:
app_id: ${{ secrets.CICD_APP_ID }}
private_key: ${{ secrets.CICD_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
with:
repository: ${{ github.repository }}
token: ${{ steps.podaac-cicd.outputs.token }}
- uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install bumpver
run: pip3 install bumpver
- name: Setup git user
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
# -- Version Bumping --
- name: Bump alpha version
if: github.ref == 'refs/heads/develop'
run: |
TAG=$(bumpver show -e | awk -F= '$1 == "TAG" {print $2};')
if [ $TAG == 'final' ]; then
# Bump patch version first then append tag
bumpver update --patch --tag alpha --tag-num
else
bumpver update --tag alpha --tag-num
fi
- name: Bump rc version
if: startsWith(github.ref, 'refs/heads/release/')
run: bumpver --tag rc --tag-num
- name: Release version
if: github.ref == 'refs/heads/main'
run: bumpver --tag final
# -- Building --
- name: Build with Gradle
run: gradle build
- name: Build & push container images
# Only push container images for releases, rcs, and alphas
if: >
github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/develop' ||
startsWith(github.ref, 'refs/heads/release/')
run: |
# gradle jib
# Push one tag at a time; fix for multi-tag push issue in ghcr (but fixed in gitlab)
# https://gitlab.com/gitlab-org/container-registry/-/issues/640
gradle jibDockerBuild
for TAG in $(docker image ls -f "dangling=false" --format "{{.Tag}}" ghcr.io/podaac/swodlr-api); do
docker image push ghcr.io/podaac/swodlr-api:$TAG
done
- name: Upload compiled .jars
uses: actions/[email protected]
with:
name: build-libs
path: build/libs/*.jar
- name: Upload test reports
if: always()
uses: actions/[email protected]
with:
name: reports
path: build/reports