Skip to content

Merge pull request #5 from buildrun-tech/feature/updates-readme #5

Merge pull request #5 from buildrun-tech/feature/updates-readme

Merge pull request #5 from buildrun-tech/feature/updates-readme #5

Workflow file for this run

name: CD
on:
push:
branches: [ "main" ]
jobs:
determine-next-version-number:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.get-latest-release.outputs.new_version }}
steps:
- name: Determine next version
id: version
run: |
last_tag=$(git describe --abbrev=0)
commit_range="${last_tag}..HEAD"
major=0
minor=0
patch=0
while IFS= read -r line; do
case "$line" in
*'feat:'*)
minor=$((minor + 1))
;;
*'fix:'*)
patch=$((patch + 1))
;;
*'BREAKING CHANGE:'*)
major=$((major + 1))
;;
esac
done < <(git log --pretty=format:"%s" "$commit_range")
if [ $major -gt 0 ]; then
new_version="$((major + 1)).0.0"
elif [ $minor -gt 0 ]; then
new_version="$major.$((minor + 1)).0"
else
new_version="$major.$minor.$((patch + 1))"
fi
echo "NEW VERSION SHOULD BE => $new_version"
echo "::set-output name=new_version::$new_version"
re-build:
needs: get-latest-release-number

Check failure on line 45 in .github/workflows/cd.yml

View workflow run for this annotation

GitHub Actions / CD

Invalid workflow file

The workflow is not valid. .github/workflows/cd.yml (Line: 45, Col: 12): Job 're-build' depends on unknown job 'get-latest-release-number'. .github/workflows/cd.yml (Line: 60, Col: 12): Job 're-test' depends on unknown job 'get-latest-release-number'.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file app/pom.xml
re-test:
needs: get-latest-release-number
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Test with Maven
run: mvn test --file app/pom.xml
generate-release:
needs: [re-test, re-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm' # See 'Options' for all available distributions
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Debug step
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
- name: Compile to native image
run: |
pwd
ls
mvn -Pnative native:compile --file app/pom.xml
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
${{ github.workspace }}
tag_name: ${{ needs.get-latest-release-number.outputs.new_version }}
release_name: Release ${{ needs.get-latest-release-number.outputs.new_version }}
body: |
$(echo "Release notes for version ${{ needs.get-latest-release-number.outputs.new_version }}:")
$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0)..HEAD)
token: ${{ secrets.GITHUB_TOKEN }}