|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 7 | + |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Create Release |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v2 |
| 17 | + |
| 18 | + |
| 19 | + - name: Create release name using the tag name |
| 20 | + run: | |
| 21 | + githubRef=${{ github.ref }} |
| 22 | + githubRef="${githubRef/'refs/tags'/''}" |
| 23 | + githubRef="${githubRef/'/'/''}" |
| 24 | + githubRef="${githubRef/'v'/''}" |
| 25 | + echo "releaseLabel=$githubRef" >> $GITHUB_ENV |
| 26 | +
|
| 27 | +
|
| 28 | + - name: Print release label |
| 29 | + run: echo $releaseLabel |
| 30 | + |
| 31 | + |
| 32 | + - name: Create release directory |
| 33 | + run: mkdir -p release/bin |
| 34 | + |
| 35 | + |
| 36 | + ### Generate jar file |
| 37 | + |
| 38 | + - name: Set up JDK 11 |
| 39 | + uses: actions/setup-java@v2 |
| 40 | + with: |
| 41 | + java-version: '11' |
| 42 | + distribution: 'adopt' |
| 43 | + |
| 44 | + |
| 45 | + - name: Install Maven |
| 46 | + run: sudo apt install maven |
| 47 | + |
| 48 | + |
| 49 | + - name: Check Maven Version |
| 50 | + run: mvn -version |
| 51 | + |
| 52 | + |
| 53 | + - name: Build jar using Maven |
| 54 | + run: mvn --batch-mode install verify -U -X |
| 55 | + |
| 56 | + |
| 57 | + ### Create zip file |
| 58 | + |
| 59 | + - name: Copy jar file from the dist to the release directory |
| 60 | + run: cp dist/javaxt-orm*.jar release/bin/javaxt-orm.jar |
| 61 | + |
| 62 | + |
| 63 | + - name: Copy release assets to the release directory |
| 64 | + run: cp -r src LICENSE.TXT release |
| 65 | + |
| 66 | + |
| 67 | + - name: Create zip file |
| 68 | + run: cd release; zip -r ../javaxt-orm_v${{ env.releaseLabel }}.zip * |
| 69 | + |
| 70 | + |
| 71 | + ### Upload zip file to javaxt.com |
| 72 | + |
| 73 | + - name: Upload release to server |
| 74 | + run: >- |
| 75 | + curl -X POST -L |
| 76 | + -H "Authorization: ${{ secrets.UPLOAD_AUTH }}" |
| 77 | + -F "file=@javaxt-orm_v${{ env.releaseLabel }}.zip;type=application/zip" |
| 78 | + "${{ secrets.UPLOAD_URL }}" |
| 79 | +
|
0 commit comments