From fe7ef71928ccda91bf3b71ef6c8b13c6cc6ecbdb Mon Sep 17 00:00:00 2001 From: Oliver Lockwood Date: Fri, 5 Jan 2024 11:12:44 +0000 Subject: [PATCH] CI: move from Travis to Github Actions --- .travis.settings.xml => .ci.settings.xml | 0 .github/workflows/ci-build.yml | 36 +++++++++++++++++++ .github/workflows/ci-publish.yml | 44 ++++++++++++++++++++++++ README.md | 11 ++++-- 4 files changed, 89 insertions(+), 2 deletions(-) rename .travis.settings.xml => .ci.settings.xml (100%) create mode 100644 .github/workflows/ci-build.yml create mode 100644 .github/workflows/ci-publish.yml diff --git a/.travis.settings.xml b/.ci.settings.xml similarity index 100% rename from .travis.settings.xml rename to .ci.settings.xml diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 0000000..3534e01 --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,36 @@ +name: 'CI Build' + +on: + workflow_dispatch: + push: + branches: + - master + pull_request: + types: [ opened, reopened, edited ] + branches: + - master + +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: false + +jobs: + compile-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Java and Maven + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '8' + cache: 'maven' + cache-dependency-path: 'pom.xml' + + - name: Compile + run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V + + - name: Run tests + run: mvn test -B diff --git a/.github/workflows/ci-publish.yml b/.github/workflows/ci-publish.yml new file mode 100644 index 0000000..19e58fa --- /dev/null +++ b/.github/workflows/ci-publish.yml @@ -0,0 +1,44 @@ +name: 'CI Publish to Maven Central' + +on: + workflow_dispatch: + push: + tags: + - 'release/*' + +concurrency: + group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' + cancel-in-progress: false + +jobs: + compile-test-and-publish-to-maven-central: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Java and Maven + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '8' + cache: 'maven' + cache-dependency-path: 'pom.xml' + + - name: Compile + run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V + + - name: Run tests + run: mvn test -B + + - name: Copy publishing-config settings.xml into place + run: cp .ci.settings.xml $HOME/.m2/settings.xml + + - name: Publish to Maven Central + run: ./publish.sh + env: + SONATYPE_GPGKEY_FILE_ENCRYPTION_KEY: ${{ secrets.SONATYPE_GPGKEY_FILE_ENCRYPTION_KEY }} + SONATYPE_GPGKEY_FILE_ENCRYPTION_IV: ${{ secrets.SONATYPE_GPGKEY_FILE_ENCRYPTION_IV }} + SONATYPE_GPGKEY_PASSPHRASE: ${{ secrets.SONATYPE_GPGKEY_PASSPHRASE }} + SONATYPE_USERNAME: ${{ vars.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} diff --git a/README.md b/README.md index 886c8fa..3bd5e03 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![CI Build](https://github.com/dalet-oss/vfs-gcs/actions/workflows/ci-build.yml/badge.svg)](https://github.com/dalet-oss/vfs-gcs/actions/workflows/ci-build.yml) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.dalet-oss/vfs-gcs/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.dalet-oss/vfs-gcs) [![Licence](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/dalet-oss/vfs-gcs/blob/master/LICENSE) +--- + # vfs-gcs Google Cloud Storage provider for Apache Commons VFS - http://commons.apache.org/proper/commons-vfs/ @@ -11,8 +14,12 @@ and occasionally offer our changes upstream. ## Builds, releases etc. -This project is built using Travis CI. -[![Build Status](https://app.travis-ci.com/dalet-oss/vfs-gcs.svg?branch=master)](https://app.travis-ci.com/dalet-oss/vfs-gcs) +This project is built using Github Actions. + +- All pushes to the `master` branch trigger the [![CI Build](https://github.com/dalet-oss/vfs-gcs/actions/workflows/ci-build.yml/badge.svg)](https://github.com/dalet-oss/vfs-gcs/actions/workflows/ci-build.yml) + workflow. +- All pushes of Git tags matching `release/*` trigger the [![CI Publish to Maven Central](https://github.com/dalet-oss/vfs-gcs/actions/workflows/ci-publish.yml/badge.svg?branch=master&event=push)](https://github.com/dalet-oss/vfs-gcs/actions/workflows/ci-publish.yml) + workflow. Published artifacts are available on Maven Central as `com.github.dalet-oss:vfs-gcs`.