Build and Run #85
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
name: Build and Run | |
on: workflow_dispatch | |
jobs: | |
build_and_run: | |
runs-on: ubuntu-latest | |
outputs: | |
VALUE: ${{ steps.short_hash.outputs.VALUE }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set SHORT_HASH | |
run: | | |
echo "::set-output name=VALUE::${LONG_HASH:0:8}" | |
echo "RELEASE_TAG=${LONG_HASH:0:8}-$(TZ=UTC-8 date +"%Y.%m.%d")" >> $GITHUB_ENV | |
id: short_hash | |
env: | |
LONG_HASH: ${{ github.sha }} | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Set up Maven | |
uses: stCarolas/[email protected] | |
with: | |
maven-version: 3.9.3 | |
- name: Create output folder | |
run: mkdir BuildOutput | |
- name: Build edgechain-app project | |
working-directory: ./FlySpring | |
# run: mvn -Djavacpp.platform=linux-x86_64 clean package -DskipTests | |
run: mvn clean package -DskipTests | |
- name: Run edgechain testcases | |
working-directory: ./FlySpring | |
run: mvn test | |
- name: Copy edgechain-app JAR to Examples folder | |
run: cp ./FlySpring/edgechain-app/target/edgechain.jar ./BuildOutput/ | |
- name: Upload Examples folder as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Output | |
path: ./BuildOutput/ | |
release: | |
name: Release jar | |
needs: build_and_run | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download jar from build | |
uses: actions/download-artifact@v3 | |
with: | |
name: Output | |
path: Output | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: 'Get variables' | |
id: vars | |
run: | | |
echo "tag_name= ${{needs.build_and_run.outputs.VALUE}}" >> $GITHUB_OUTPUT | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.RELEASE_TAG }} | |
# body: 🚀 Automated build | |
files: | | |
./Output/**/*.* | |
# tag_name: ${{needs.build_and_run.steps.short_hash.outputs.VALUE}} | |