diff --git a/.github/workflows/CI.yml b/.github/workflows/ci.yml similarity index 53% rename from .github/workflows/CI.yml rename to .github/workflows/ci.yml index 6cd9ab1..81cd53e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/ci.yml @@ -8,32 +8,40 @@ on: jobs: build: - runs-on: ubuntu-latest + outputs: + version: ${{steps.build.outputs.version}} steps: - uses: actions/checkout@v3 + - name: Set up JDK 8 uses: actions/setup-java@v3 with: java-version: '8' distribution: 'temurin' - cache: maven - - name: Build with Maven - run: mvn compile - - id: project - name: Extract Maven project version - run: echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> "$GITHUB_OUTPUT" + cache: 'maven' + + - id: build + name: Build with Maven + run: | + mvn compile + echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> "$GITHUB_OUTPUT" + - name: Test with Maven run: mvn test --batch-mode --fail-at-end + - name: Publish Test Report if: success() || failure() uses: scacap/action-surefire-report@v1 + - name: Package with maven run: mvn package - - uses: actions/upload-artifact@v3 + + - name: Upload artifacts + uses: actions/upload-artifact@v3 with: - name: vinted-kafka-connect-vespa-${{ steps.project.outputs.version }} + name: vinted-kafka-connect-vespa-${{ steps.build.outputs.version }} path: | - target/kafka-connect-vespa-${{ steps.project.outputs.version }}-jar-with-dependencies.jar - target/components/packages/vinted-kafka-connect-vespa-${{ steps.project.outputs.version }}.zip + target/components/packages/vinted-kafka-connect-vespa-${{ steps.build.outputs.version }}.zip + target/components/kafka-connect-vespa-${{ steps.build.outputs.version }}.jar diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d7ac56f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,49 @@ +name: Release + +on: + release: + types: [ published ] + +jobs: + release: + runs-on: ubuntu-latest + outputs: + version: ${{steps.build.outputs.version}} + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - run: | + git config user.name github-actions + git config user.email github-actions@github.com + + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + cache: 'maven' + + - id: build + name: Build with Maven + run: | + mvn -B -ntp versions:set -DnewVersion=${{ github.event.release.tag_name }} + mvn -B -V -ntp clean package -DskipTests + echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> "$GITHUB_OUTPUT" + + - name: Upload files to a GitHub release + uses: svenstaro/upload-release-action@2.3.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: target/components/packages/kafka-connect-vespa-${{ steps.build.outputs.version }}.zip + tag: ${{ steps.build.outputs.version }} + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: vinted-kafka-connect-vespa-${{ steps.build.outputs.version }} + path: | + target/components/packages/vinted-kafka-connect-vespa-${{ steps.build.outputs.version }}.zip + target/components/kafka-connect-vespa-${{ steps.build.outputs.version }}.jar