Skip to content

Some slight changes #388

Some slight changes

Some slight changes #388

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
push:
branches: [ "main", "dev", "fixes/**", "features/**", "rewrite/**" ]
jobs:
build:
runs-on: ubuntu-latest
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Setup .env file
env:
REDIS_HOSTNAME: localhost
REDIS_PORT: 6379
MONGO_DATABASE_NAME: ${{ secrets.MONGO_DATABASE_NAME }}
MONGO_USERNAME: ${{ secrets.MONGO_USERNAME }}
MONGO_PASSWORD: ${{ secrets.MONGO_PASSWORD }}
MONGO_HOSTNAME: ${{ secrets.MONGO_HOSTNAME }}
MONGO_CLUSTER_NAME: ${{ secrets.MONGO_CLUSTER_NAME }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
KTOR_API_PORT: ${{ secrets.KTOR_API_PORT }}
KTOR_API_SECRET_KEY: ${{ secrets.KTOR_API_SECRET_KEY }}
SPOTIFY_CLIENT_ID: $${{ secrets.SPOTIFY_CLIENT_ID }}
SPOTIFY_CLIENT_SECRET: $${{ secrets.SPOTIFY_CLIENT_SECRET }}
DEEZER_ACCESS_TOKEN: $${{ secrets.DEEZER_ACCESS_TOKEN }}
run: |
touch .env
echo REDIS_HOSTNAME="$REDIS_HOSTNAME" >> .env
echo REDIS_PORT="$REDIS_PORT" >> .env
echo MONGO_DATABASE_NAME="$MONGO_DATABASE_NAME" >> .env
echo MONGO_USERNAME="$MONGO_USERNAME" >> .env
echo MONGO_PASSWORD="$MONGO_PASSWORD" >> .env
echo MONGO_HOSTNAME="$MONGO_HOSTNAME" >> .env
echo MONGO_CLUSTER_NAME="$MONGO_CLUSTER_NAME" >> .env
echo BOT_TOKEN="$BOT_TOKEN" >> .env
echo KTOR_API_PORT="$KTOR_API_PORT" >> .env
echo KTOR_API_SECRET_KEY="$KTOR_API_SECRET_KEY" >> .env
echo SPOTIFY_CLIENT_ID="$SPOTIFY_CLIENT_ID" >> .env
echo SPOTIFY_CLIENT_SECRET="$SPOTIFY_CLIENT_SECRET" >> .env
echo DEEZER_ACCESS_TOKEN="$DEEZER_ACCESS_TOKEN" >> .env
shell: bash
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache the Maven packages to speed up build
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
publish-job:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Cache the Maven packages to speed up build
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- run: mvn -B package --file pom.xml -DskipTests
- run: mkdir staging && cp target/*jar-with-dependencies.jar staging
- name: Upload bot artifact
uses: actions/upload-artifact@v3
with:
name: Robertify-Bot
path: staging