diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b4c8631 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: CryptoSlice + +on: [push, workflow_dispatch] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '8' + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Build with Maven + run: mvn --batch-mode --update-snapshots verify + + - name: Install ZIP action + uses: montudor/action-zip@v1 + + - name: Create empty apps directory + run: mkdir -p target/apps + + - name: Bundle JAR output with directories in ZIP file + run: zip -r CryptoSlice.zip CryptoSlice-1.0-SNAPSHOT-jar-with-dependencies.jar apps conf + working-directory: target + + - name: Store build artifacts + uses: actions/upload-artifact@v2 + with: + name: CryptoSlice + path: target/CryptoSlice.zip + if-no-files-found: error + + release: + name: Release + if: startsWith(github.ref, 'refs/tags/') + needs: build + runs-on: ubuntu-latest + steps: + - name: Retrieve build artifacts + uses: actions/download-artifact@v2 + with: + name: CryptoSlice + + - name: Create release + id: create_release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + body: CryptoSlice + files: CryptoSlice.zip