diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2d024340..a3669a45 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,10 +1,6 @@ name: CD Pipeline on: - push: - branches: - - develop # develop 브랜치에 merge될 때 트리거 - - 'weekly/**' pull_request: branches: - develop diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f599e97..1dda4c56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,15 +16,6 @@ jobs: build-and-test: runs-on: ubuntu-22.04 - env: - MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }} - MYSQL_USER: ${{ secrets.MYSQL_USER }} - MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} - MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - JWT_SECRET: ${{ secrets.JWT_SECRET }} - services: mysql: image: mysql:8.0 @@ -60,17 +51,15 @@ jobs: restore-keys: | gradle-${{ runner.os }}- - - name: Create env.properties + - name: Decode env.properties from GitHub Secrets + run: | + echo "${{ secrets.ENV_FILE }}" | base64 --decode > ./src/main/resources/env.properties + + - name: Set environment variables from env.properties run: | - echo "MYSQL_DATABASE=${{ secrets.MYSQL_DATABASE }}" >> env.properties - echo "MYSQL_USER=${{ secrets.MYSQL_USER }}" >> env.properties - echo "MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }}" >> env.properties - echo "MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }}" >> env.properties - echo "CLIENT_ID=${{ secrets.CLIENT_ID }}" >> env.properties - echo "CLIENT_SECRET=${{ secrets.CLIENT_SECRET }}" >> env.properties - echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> env.properties - echo "REDIRECT_URL=${{ secrets.REDIRECT_URL }}" >> env.properties - cp env.properties ./src/main/resources + set -o allexport + source ./src/main/resources/env.properties + set +o allexport - name: Set up JDK 21 uses: actions/setup-java@v2 @@ -93,25 +82,13 @@ jobs: docker logs $(docker ps -q --filter name=mysql) exit 1 fi - env: - MYSQL_USER: ${{ secrets.MYSQL_USER }} - MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }} - name: Build with Gradle run: ./gradlew build env: SPRING_PROFILES_ACTIVE: local - MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }} - MYSQL_USER: ${{ secrets.MYSQL_USER }} - MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} - name: Run Tests run: ./gradlew test env: SPRING_PROFILES_ACTIVE: local - MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }} - MYSQL_USER: ${{ secrets.MYSQL_USER }} - MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - JWT_SECRET: ${{ secrets.JWT_SECRET }}