Skip to content

Commit

Permalink
Added github CI Action
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Feb 2, 2025
1 parent 0449eda commit 685a0cf
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 20 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Java CI with Maven

env:
# find out this value by opening https://api.github.com/repos/<owner>/<repo>/releases
# in your browser and copy the full "upload_url" value including the {?name,label} part
UPLOAD_URL: https://uploads.github.com/repos/MarginallyClever/Donatello/releases/197988121/assets{?name,label}
RELEASE_ID: 197988121 # same as above (id can just be taken out the upload_url, it's used to find old releases)

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'

# from https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
- name: Build and Test with Maven
timeout-minutes: 15
run: mvn --batch-mode --update-snapshots package

- name: Prepare nightly package
shell: bash
run: |
mkdir -p target/universal-package &&
cp CONTRIBUTING.md LICENSE README.md target/universal-package/ &&
cp target/nodegraphcore-*.jar target/universal-package/ &&
cd target/universal-package/ &&
7z a -tzip NodeGraphCore.zip . &&
mv NodeGraphCore.zip ../..
- name: Deploy nightly release
if: github.repository == 'MarginallyClever/Donatello' && github.ref == 'refs/heads/main'
uses: WebFreak001/deploy-nightly@v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
with:
upload_url: ${{ env.UPLOAD_URL }}
release_id: ${{ env.RELEASE_ID }}{
asset_path: Donatello.zip # path to archive to upload
asset_name: Donatello-nightly-$$.zip # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
asset_content_type: application/zip # required by GitHub API
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
37 changes: 37 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path

name: Maven Package

on:
push:
branches:
- main
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 0 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,26 +153,6 @@
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/package</outputDirectory>
<resources>
<resource>
<directory>src/main/package</directory>
<includes>
<include>avrdude.*</include>
<include>firmware.hex</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-fat-jar</id>
<phase>package</phase>
Expand Down

0 comments on commit 685a0cf

Please sign in to comment.