|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + [push] |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + name: Build and Test |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v2 |
| 12 | + - uses: actions/setup-java@v1 |
| 13 | + with: |
| 14 | + java-version: 14 |
| 15 | + - uses: actions/cache@v1 |
| 16 | + with: |
| 17 | + path: ~/.m2/repository |
| 18 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 19 | + restore-keys: | |
| 20 | + ${{ runner.os }}-maven- |
| 21 | + - name: Ensure to use tagged version |
| 22 | + run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags' |
| 23 | + if: startsWith(github.ref, 'refs/tags/') |
| 24 | + - name: Build and Test |
| 25 | + run: mvn -B install |
| 26 | + - name: Upload cryptomator-cli-XXX.jar |
| 27 | + uses: actions/upload-artifact@v1 |
| 28 | + with: |
| 29 | + name: cryptomator-cli.jar |
| 30 | + path: target/cryptomator-cli-*.jar |
| 31 | + |
| 32 | + release: |
| 33 | + name: Draft a Release on GitHub Releases |
| 34 | + runs-on: ubuntu-latest |
| 35 | + needs: build |
| 36 | + if: startsWith(github.ref, 'refs/tags/') |
| 37 | + steps: |
| 38 | + - name: Download cryptomator-cli.jar |
| 39 | + uses: actions/download-artifact@v1 |
| 40 | + with: |
| 41 | + name: cryptomator-cli.jar |
| 42 | + path: . |
| 43 | + - name: Create Release |
| 44 | + id: create_release |
| 45 | + uses: actions/create-release@v1 |
| 46 | + env: |
| 47 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + with: |
| 49 | + tag_name: ${{ github.ref }} |
| 50 | + release_name: ${{ github.ref }} |
| 51 | + body: | |
| 52 | + :construction: Work in Progress |
| 53 | + draft: true |
| 54 | + prerelease: false |
| 55 | + - name: Upload cryptomator-cli.jar to GitHub Releases |
| 56 | + uses: actions/upload-release-asset@v1.0.1 |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + with: |
| 60 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 61 | + asset_path: cryptomator-cli.jar |
| 62 | + asset_name: cryptomator-cli-${{ github.ref }}.jar |
| 63 | + asset_content_type: application/jar |
0 commit comments