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