~exprez135/cryptomator-libre

ref: 6ccd248675e96dfd6d1a8a8ea869797a51c2afed cryptomator-libre/.github/workflows/build.yml -rw-r--r-- 4.7 KiB
6ccd2486 — Sebastian Stenzel use maven profiles to build different buildkits 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Build

on:
  [push]

jobs: 
  build:
    name: Build and Test
    runs-on: ubuntu-latest
    if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with:
          java-version: 14
      - uses: actions/cache@v1
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-
      - name: Ensure to use tagged version
        run: mvn versions:set --file main/pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags'
        if: startsWith(github.ref, 'refs/tags/')
      - name: Build and Test
        run: mvn -B install --file main/pom.xml -Pcoverage
      - name: Run Codacy Coverage Reporter
        run: |
          curl -o ~/codacy-coverage-reporter.jar https://repo.maven.apache.org/maven2/com/codacy/codacy-coverage-reporter/7.1.0/codacy-coverage-reporter-7.1.0-assembly.jar
          $JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar report -l Java -r main/commons/target/site/jacoco/jacoco.xml --partial
          $JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar report -l Java -r main/ui/target/site/jacoco/jacoco.xml --partial
          $JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar report -l Java -r main/launcher/target/site/jacoco/jacoco.xml --partial
          $JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar final
        env:
          CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
      - name: Assemble buildkit-linux.zip
        run: mvn -B clean package -DskipTests --file main/pom.xml --resume-from=buildkit -Prelease,linux
      - name: Upload buildkit-linux.zip
        uses: actions/upload-artifact@v1
        with:
          name: buildkit-linux.zip
          path: main/buildkit/target/buildkit-linux.zip
      - name: Assemble buildkit-mac.zip
        run: mvn -B clean package -DskipTests --file main/pom.xml --resume-from=buildkit -Prelease,mac
      - name: Upload buildkit-mac.zip
        uses: actions/upload-artifact@v1
        with:
          name: buildkit-mac.zip
          path: main/buildkit/target/buildkit-mac.zip
      - name: Assemble buildkit-win.zip
        run: mvn -B clean package -DskipTests --file main/pom.xml --resume-from=buildkit -Prelease,win
      - name: Upload buildkit-win.zip
        uses: actions/upload-artifact@v1
        with:
          name: buildkit-win.zip
          path: main/buildkit/target/buildkit-win.zip
          
  release:
    name: Draft a Release on GitHub Releases
    runs-on: ubuntu-latest
    needs: build
    if: startsWith(github.ref, 'refs/tags/')
    steps:
      - name: Download buildkit-linux.zip
        uses: actions/download-artifact@v1
        with:
          name: buildkit-linux.zip
          path: .
      - name: Download buildkit-mac.zip
        uses: actions/download-artifact@v1
        with:
          name: buildkit-mac.zip
          path: .
      - name: Download buildkit-win.zip
        uses: actions/download-artifact@v1
        with:
          name: buildkit-win.zip
          path: .
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: ${{ github.ref }}
          body: |
            :construction: Work in Progress
          draft: true
          prerelease: false
      - name: Upload buildkit-linux.zip to GitHub Releases
        uses: actions/upload-release-asset@v1.0.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: buildkit-linux.zip
          asset_name: buildkit-linux.zip
          asset_content_type: application/zip
      - name: Upload buildkit-mac.zip to GitHub Releases
        uses: actions/upload-release-asset@v1.0.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: buildkit-mac.zip
          asset_name: buildkit-mac.zip
          asset_content_type: application/zip
      - name: Upload buildkit-win.zip to GitHub Releases
        uses: actions/upload-release-asset@v1.0.1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: buildkit-win.zip
          asset_name: buildkit-win.zip
          asset_content_type: application/zip