Skip to content

Commit

Permalink
CI: move from Travis to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlockwood committed Jan 5, 2024
1 parent a781d60 commit 9002452
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 5 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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
defaults:
run:
working-directory: vfs-azure
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: 'vfs-azure/pom.xml'

- name: Compile
run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V

- name: Run tests
run: mvn test -B
env:
AZURE_ACCOUNT_NAME: ${{ vars.AZURE_ACCOUNT_NAME }}
AZURE_ACCOUNT_KEY: ${{ secrets.AZURE_ACCOUNT_KEY }}
AZURE_TEST0001_CONTAINER_NAME: ${{ vars.AZURE_TEST0001_CONTAINER_NAME }}
54 changes: 54 additions & 0 deletions .github/workflows/ci-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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
defaults:
run:
working-directory: vfs-azure
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: 'vfs-azure/pom.xml'

- name: Compile
run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V

- name: Run tests
run: mvn test -B
env:
AZURE_ACCOUNT_NAME: ${{ vars.AZURE_ACCOUNT_NAME }}
AZURE_ACCOUNT_KEY: ${{ secrets.AZURE_ACCOUNT_KEY }}
AZURE_TEST0001_CONTAINER_NAME: ${{ vars.AZURE_TEST0001_CONTAINER_NAME }}

- 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:
AZURE_ACCOUNT_NAME: ${{ vars.AZURE_ACCOUNT_NAME }}
AZURE_ACCOUNT_KEY: ${{ secrets.AZURE_ACCOUNT_KEY }}
AZURE_TEST0001_CONTAINER_NAME: ${{ vars.AZURE_TEST0001_CONTAINER_NAME }}
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 }}
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![CI Build](https://github.com/dalet-oss/vfs-azure/actions/workflows/ci-build.yml/badge.svg)](https://github.com/dalet-oss/vfs-azure/actions/workflows/ci-build.yml) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.dalet-oss/vfs-azure/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.dalet-oss/vfs-azure) [![Licence](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/dalet-oss/vfs-azure/blob/master/LICENSE)
---

# vfs-azure

Azure provider for Apache Commons VFS - http://commons.apache.org/proper/commons-vfs/
Expand All @@ -15,8 +18,12 @@ maintain this not as a fork of the original project but as a project in its own

## Builds, releases etc.

This project is built using Travis CI.
[![Build Status](https://app.travis-ci.com/dalet-oss/vfs-azure.svg?branch=master)](https://app.travis-ci.com/dalet-oss/vfs-azure)
This project is built using Github Actions.

- All pushes to the `master` branch trigger the [![CI Build](https://github.com/dalet-oss/vfs-azure/actions/workflows/ci-build.yml/badge.svg)](https://github.com/dalet-oss/vfs-azure/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-azure/actions/workflows/ci-publish.yml/badge.svg?branch=master&event=push)](https://github.com/dalet-oss/vfs-azure/actions/workflows/ci-publish.yml)
workflow.

Published artifacts are available on Maven Central as `com.github.dalet-oss:vfs-azure`.

Expand All @@ -30,6 +37,7 @@ For the latest version, see https://github.com/dalet-oss/vfs-azure/tags.
the next build.



## Documentation

From the website...
Expand Down
File renamed without changes.
15 changes: 12 additions & 3 deletions vfs-azure/publish.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
echo "Determining version number for publication"
echo "Looking for an existing release tag against this commit"
echo 'Determining version number for publication'
echo 'Looking for an existing release tag against this commit'

VERSION=$(git describe --tags --match release/* --exact-match 2>&1)
if [ $? -ne 0 ]
Expand All @@ -23,9 +23,18 @@ if [ $status -eq 200 ]
then
echo 'Version already available on Maven Central. This must be a rebuild; nothing to do here.'
else
echo 'Version not already available on Maven Central'

# Decrypt the gpg key used for signing
openssl aes-256-cbc -K $encrypted_a559f7c88919_key -iv $encrypted_a559f7c88919_iv -in secret.gpg.enc -out secret.gpg -d
echo 'Decrypting the GPG key used for signing'
openssl aes-256-cbc -K ${SONATYPE_GPGKEY_FILE_ENCRYPTION_KEY} -iv ${SONATYPE_GPGKEY_FILE_ENCRYPTION_IV} -in secret.gpg.enc -out secret.gpg -d
export GPG_TTY=$(tty)
if [ ! -f secret.gpg ]
then
echo 'Decryption failed; bail out'
exit 1
fi
echo 'Decryption successful'

# Work around some nonsense on the specific version of GPG that comes with Ubuntu - see https://www.fluidkeys.com/tweak-gpg-2.1.11/
echo 'allow-loopback-pinentry' >> ~/.gnupg/gpg-agent.conf
Expand Down

0 comments on commit 9002452

Please sign in to comment.