|
| 1 | +name: CI |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + pull_request: |
| 9 | + branches: [main] |
| 10 | + |
| 11 | +jobs: |
| 12 | + version_check: |
| 13 | + name: Version Check |
| 14 | + outputs: |
| 15 | + UPSTREAM_VERSION: "${{ steps.latest-releases.outputs.upstream-version }}" |
| 16 | + RELEASES_VERSION: "${{ steps.latest-releases.outputs.releases-version }}" |
| 17 | + runs-on: ubuntu-latest |
| 18 | + timeout-minutes: 600 |
| 19 | + steps: |
| 20 | + - name: Check latest release in upstream |
| 21 | + id: latest-releases |
| 22 | + run: | |
| 23 | + get_latest_release() { |
| 24 | + URL="https://github.com/$1/$2/releases/latest" |
| 25 | +
|
| 26 | + VERSION=$(curl -is "$URL" \ |
| 27 | + | grep location \ |
| 28 | + | awk -F '/' '{print $8}') |
| 29 | +
|
| 30 | + echo "${VERSION/$'\r'/}" |
| 31 | + } |
| 32 | +
|
| 33 | + UPS_VER="$(get_latest_release 'microsoft' 'java-debug')" |
| 34 | + REL_VER="$(get_latest_release 'nvim-java' 'vscode-java-debug-releases')" |
| 35 | +
|
| 36 | + echo "upstream-version=$UPS_VER" >> "$GITHUB_OUTPUT" |
| 37 | + echo "releases-version=$REL_VER" >> "$GITHUB_OUTPUT" |
| 38 | +
|
| 39 | + linux: |
| 40 | + name: "Release" |
| 41 | + needs: version_check |
| 42 | + if: needs.version_check.outputs.UPSTREAM_VERSION != needs.version_check.outputs.RELEASES_VERSION |
| 43 | + runs-on: ubuntu-latest |
| 44 | + env: |
| 45 | + VERSION: "${{ needs.version_check.outputs.UPSTREAM_VERSION }}" |
| 46 | + steps: |
| 47 | + - name: Check with current version |
| 48 | + run: | |
| 49 | + # wget "https://github.com/microsoft/java-debug/archive/refs/tags/${VERSION}.tar.gz" |
| 50 | + # tar xf "${VERSION}.tar.gz" -C . --strip-components=1 |
| 51 | + git clone "https://github.com/microsoft/java-debug.git" . |
| 52 | +
|
| 53 | + - name: Set up JDK 17 |
| 54 | + uses: actions/setup-java@v1 |
| 55 | + with: |
| 56 | + java-version: "17" |
| 57 | + |
| 58 | + - name: Cache local Maven repository |
| 59 | + uses: actions/cache@v2 |
| 60 | + with: |
| 61 | + path: ~/.m2/repository |
| 62 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 63 | + restore-keys: | |
| 64 | + ${{ runner.os }}-maven- |
| 65 | +
|
| 66 | + - name: Verify |
| 67 | + run: ./mvnw clean verify |
| 68 | + |
| 69 | + - name: Checkstyle |
| 70 | + run: ./mvnw checkstyle:check |
| 71 | + |
| 72 | + - name: Prepare Artifacts |
| 73 | + run: | |
| 74 | + mkdir -p extension/server |
| 75 | + mv \ |
| 76 | + "com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-${VERSION}.jar" \ |
| 77 | + extension/server |
| 78 | +
|
| 79 | + zip -r "artifacts.zip" extension |
| 80 | +
|
| 81 | + - uses: ncipollo/release-action@v1 |
| 82 | + with: |
| 83 | + artifacts: "artifacts.zip" |
| 84 | + allowUpdates: true |
| 85 | + artifactErrorsFailBuild: true |
| 86 | + name: "${{ env.VERSION }}" |
| 87 | + tag: "${{ env.VERSION }}" |
0 commit comments