Reusable github workflows for FAIRDataTeam repositories.
For more info about reusing workflows, see sharing automations documentation, specifically:
The following FAIRDataTeam repositories depend on the reusable workflows from this repo:
- FAIRDataPoint
- FAIRDataPoint-client
- rdf-resource-resolver
- spring-rdf-migration
- spring-security-acl-mongodb
An example of a publication workflow that is triggered when a release is created, and re-uses two workflows:
name: Maven publishon:
release:
types: [created]jobs:
test:
uses: FAIRDataTeam/github-workflows/.github/workflows/maven-verify.yml@v2publish:
needs: testuses: FAIRDataTeam/github-workflows/.github/workflows/maven-publish.yml@v2secrets: inheritIt is also possible to specify additional options for the maven-verify workflow, for example:
jobs:
test:
uses: FAIRDataTeam/github-workflows/.github/workflows/maven-verify.yml@v2with:
mvn_options: -Dgpg.skip tidy:check com.github.spotbugs:spotbugs-maven-plugin:checkThe maven-verify workflow also supports optional database setup. For example:
jobs:
test:
uses: FAIRDataTeam/github-workflows/.github/workflows/maven-verify.yml@v2with:
# the double quotes are required for windows runnersmvn-options: '-D"spring.profiles.active"=testing'# db settings must match those defined in the spring profiledb-type: postgresqldb-version: 17db-name: fdp_testdb-username: fdpdb-password: fdpdb-port: 54321For pull requests, nothing is uploaded, but a test build is created.
The following variables and secrets must be defined in the calling repo (conforming to existing names from the FDP repos):
vars.DOCKER_IMAGE_NAMEvars.DOCKER_HUB_USERNAMEsecrets.DOCKER_HUB_PASSWORD
Secrets must be inherited from the caller.
The workflow could be triggered on push and pull_request (see [1]). For example:
name: publish to docker hub on pushon:
push:
branches:
- developpull_request:
jobs:
publish:
uses: FAIRDataTeam/github-workflows/.github/workflows/docker-publish.yml@v2secrets: inheritwith:
push: ${{ github.event_name != 'pull_request' }}Alternatively, we could push on release creation only, for example:
name: publish to docker hub on releaseon:
release:
types: [created]jobs:
publish:
uses: FAIRDataTeam/github-workflows/.github/workflows/docker-publish.yml@v2secrets: inheritwith:
push: ${{ github.event_name == 'release' && github.event.action == 'created' }}Releases follow semantic versioning.
To get the latest stable release you can refer to the major version only, e.g. v2 instead of v2.3.4.
Also see action versioning.
Note
Contributors, please read the contribution guidelines for instructions w.r.t. releases.