Merge pull request #43 from ekino/dependabot/gradle/com.fasterxml.jac… #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish snapshot | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:11.1 | |
env: | |
POSTGRES_DB: postgres-test | |
POSTGRES_USER: postgres-user | |
POSTGRES_PASSWORD: postgres-password | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd "pg_isready" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
mssql: | |
image: mcr.microsoft.com/mssql/server:2017-latest | |
env: | |
ACCEPT_EULA: Y | |
MSSQL_PID: Express | |
SA_PASSWORD: A_Str0ng_Required_Password | |
ports: | |
- 1433:1433 | |
options: >- | |
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "A_Str0ng_Required_Password" -Q 'SELECT 1' || exit 1" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
mysql: | |
image: mysql:8.0.21 | |
env: | |
MYSQL_ROOT_PASSWORD: mysql-password | |
MYSQL_DATABASE: mysql-text | |
MYSQL_USER: mysql-user | |
MYSQL_PASSWORD: mysql-password | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd "mysqladmin ping -h localhost -u mysql-user --password=mysql-password" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
mongodb: | |
image: mongo:3.1.5 | |
ports: | |
- 27017:27017 | |
options: >- | |
--health-cmd "echo 'db.runCommand({ ping: 1 })' | mongo localhost:27017/test --quiet" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
cassandra: | |
image: cassandra | |
ports: | |
- 9042:9042 | |
env: | |
CASSANDRA_DC: local | |
CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch | |
options: | |
--health-cmd "cqlsh localhost 9042 -u cassandra -p cassandra -e 'describe cluster'" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Init database data for PostgreSQL | |
run: PGPASSWORD=postgres-password psql -h localhost -p 5432 -U postgres-user -f docker/postgresql/setup.sql postgres-test | |
- name: Init database data for MySQL | |
run: | | |
mysql --host 127.0.0.1 --port 3306 -u root --password=mysql-password --database=mysql-text < docker/mysql/setup.sql | |
- name: Init database data for MSSQL | |
run: sqlcmd -S localhost -U sa -P A_Str0ng_Required_Password -d master -i docker/mssql/setup.sql | |
- name: Init database data for Cassandra | |
run: | | |
docker cp docker/cassandra/setup.cql ${{ job.services.cassandra.id }}:/setup.cql | |
docker exec ${{ job.services.cassandra.id }} cqlsh localhost 9042 -f setup.cql | |
- name: Setup java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: 11 | |
cache: "gradle" | |
- name: Check version is snapshot | |
run: | | |
PROJECT_VERSION=$(./gradlew -q printVersion | tail -n 1) | |
echo "Project version is $PROJECT_VERSION" | |
if [[ "$PROJECT_VERSION" != *"SNAPSHOT" ]]; then exit 1; fi | |
- name: Decrypt large secret | |
run: | | |
chmod +x ./.github/workflows/decrypt_secret.sh | |
./.github/workflows/decrypt_secret.sh | |
env: | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Build | |
run: ./gradlew build | |
- name: Publish | |
run: ./gradlew publish -PossrhUrl="$PUBLISH_SNAPSHOT_REPO_URL" -PossrhUsername="$PUBLISH_REPO_USERNAME" -PossrhPassword="$PUBLISH_REPO_PASSWORD" -Psigning.keyId="$GPG_KEY_ID" -Psigning.password="$GPG_PASSPHRASE" -Psigning.secretKeyRingFile="$SIGN_FILE_PATH" | |
env: | |
PUBLISH_SNAPSHOT_REPO_URL: https://oss.sonatype.org/content/repositories/snapshots/ | |
PUBLISH_REPO_USERNAME: ${{ secrets.SONATYPE_OSS_USERNAME }} | |
PUBLISH_REPO_PASSWORD: ${{ secrets.SONATYPE_OSS_PASSWORD }} | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
SIGN_FILE_PATH: "${{ github.workspace }}/.github/workflows/jcv_db_sign.gpg" |