added release to build actions #1561
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file must be in the .github/workflows folder for GitHub Actions to work | |
name: Java CI | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "11" | |
distribution: "adopt" | |
cache: "maven" | |
- name: Install Missing Dependencies | |
run: sudo apt-get install -y libv4l-0 ffmpeg | |
- name: Dependency Test # installs all dependencies | |
run: mvn test -Dtest=org.myrobotlab.framework.DependencyTest -q | |
- name: Build with Maven # currently cannot test OpenCV | |
run: mvn clean verify -q -DskipTests | |
- name: Get next version | |
uses: reecetech/[email protected] | |
id: version | |
with: | |
scheme: semver | |
increment: patch | |
- name: Package with Maven | |
run: mvn package -q -DskipTests -Dversion=${{ steps.version.outputs.version }} -q | |
- name: Rename Artifact | |
run: mv target/myrobotlab.zip target/myrobotlab-${{ steps.version.outputs.version }}.zip | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Upload Artifact to S3 | |
run: | | |
FILE="target/myrobotlab-${{ steps.version.outputs.version }}.zip" | |
BUCKET="myrobotlab-repo" | |
echo "Uploading $FILE to S3 bucket $BUCKET..." | |
aws s3 cp "$FILE" "s3://$BUCKET/" --acl public-read | |
echo "Updating permalink myrobotlab.zip..." | |
aws s3 cp "$FILE" "s3://$BUCKET/myrobotlab.zip" --acl public-read | |
- name: Upload Artifact for Release | |
uses: actions/upload-artifact@v3 | |
with: | |
name: myrobotlab | |
path: target/myrobotlab-${{ steps.version.outputs.version }}.zip | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: myrobotlab | |
path: target/ | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ needs.build.outputs.version }} | |
name: "MyRobotLab Nixie ${{ needs.build.outputs.version }}" | |
body: | | |
## MyRobotLab Nixie Release | |
Open Source Framework for Robotics and Creative Machine Control | |
*You know, for robots!* | |
* Project Website: [MyRobotLab.org](http://myrobotlab.org) | |
* Project Discord: [Join here](https://discord.gg/AfScp5x8r5) | |
* Download Built Application: [Nixie ${{ needs.build.outputs.version }}](https://myrobotlab-repo.s3.amazonaws.com/myrobotlab-${{ needs.build.outputs.version }}.zip) | |
* [JavaDocs](https://build.myrobotlab.org:8443/job/myrobotlab/job/develop/$build/artifact/target/site/apidocs/org/myrobotlab/service/package-summary.html) | |
## Base Requirements | |
You will need **Java 11 or newer**. If you are only running MyRobotLab, you need the JRE (Java Runtime Environment). | |
If you are building from source, you will need the JDK (Java Development Kit). Oracle or OpenJDK will work. | |
files: target/myrobotlab-${{ needs.build.outputs.version }}.zip | |
draft: false | |
prerelease: false |