Skip to content

Update CPG packages to v8 (major) #4159

Update CPG packages to v8 (major)

Update CPG packages to v8 (major) #4159

Workflow file for this run

name: build
on:
push:
branches:
- main
tags:
- v**
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
- name: Determine Version
run: |
# determine version from tag
export VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
if [[ $VERSION != v* ]]
then
export VERSION=""
echo "Building version-less (master or feature branch)"
else
# make version more Java-friendly by dropping the 'v'
export VERSION=${VERSION:1:${#VERSION}}
echo "Building as ${VERSION}"
fi
# store version in GitHub environment file
echo "version=$VERSION" >> $GITHUB_ENV
- name: Build ${{ env.version }}
uses: gradle/gradle-build-action@v2
with:
arguments: :codyze-cli:build -x check --parallel -Pversion=${{ env.version }}
- name: Push Release Docker Image
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker build -t ghcr.io/fraunhofer-aisec/codyze:latest .
docker tag ghcr.io/fraunhofer-aisec/codyze:latest ghcr.io/fraunhofer-aisec/codyze:${{ env.version }}
docker push ghcr.io/fraunhofer-aisec/codyze:${{ env.version }}
docker push ghcr.io/fraunhofer-aisec/codyze:latest
- name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
name: ${{ env.version }}
generate_release_notes: true
files: codyze-cli/build/distributions/codyze-cli-${{ env.version }}.zip