xref: /OpenGrok/.github/workflows/release.yml (revision b5285ff89e34ef5a1f78282e24dfc4d36b63c18a)
1name: Release
2
3# TODO: run this only for the oracle/opengrok repository
4on:
5  push:
6    tags:
7      - '[1-9]+.[0-9]+.[0-9]+'
8
9jobs:
10  get_tag:
11    name: Get tag name
12    outputs:
13      tag: ${{ steps.get_tag.outputs.tag }}
14    runs-on: ubuntu-latest
15    steps:
16      - name: Checkout master branch
17        uses: actions/checkout@v2
18      - name: Get the tag name
19        id: get_tag
20        env:
21          OPENGROK_REF: ${{ github.ref }}
22        run: ./dev/ref2tag.sh
23  build:
24    runs-on: ubuntu-latest
25    needs: get_tag
26    steps:
27    - name: Checkout master branch
28      uses: actions/checkout@v2
29    - name: Set up JDK 11
30      uses: actions/setup-java@v1
31      with:
32        java-version: 11
33    - name: Cache Maven packages
34      uses: actions/cache@v2
35      with:
36        path: ~/.m2
37        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
38        restore-keys: ${{ runner.os }}-m2
39    - name: Checkout Universal ctags
40      uses: actions/checkout@v2
41      with:
42        repository: universal-ctags/ctags
43        path: ctags
44    - name: Install pre-requisites
45      run: ./dev/before_install
46    - name: Before build actions
47      run: ./dev/before
48    - name: Build
49      run: ./mvnw -DskipTests=true -Dmaven.javadoc.skip=false -B -V package
50    - name: Create Release
51      id: create_release
52      uses: actions/create-release@v1
53      env:
54        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55      with:
56        tag_name: ${{ github.ref }}
57        release_name: ${{ github.ref }}
58        draft: false
59        prerelease: false
60    - name: Upload release tarball
61      id: upload-release-asset
62      uses: actions/upload-release-asset@v1
63      env:
64        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65      with:
66        upload_url: ${{ steps.create_release.outputs.upload_url }}
67        asset_path: ./distribution/target/opengrok-${{ needs.get_tag.outputs.tag }}.tar.gz
68        asset_name: opengrok-${{ needs.get_tag.outputs.tag }}.tar.gz
69        asset_content_type: application/octet-stream
70