diff --git a/.github/workflows/deploy-documentation.yml b/.github/workflows/deploy-documentation.yml index 03c3081..c34aa46 100644 --- a/.github/workflows/deploy-documentation.yml +++ b/.github/workflows/deploy-documentation.yml @@ -1,6 +1,6 @@ name: deploy-documentation -on: [push, pull_request, workflow_dispatch] +on: [push, workflow_dispatch] permissions: contents: write diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 0000000..c0d15fe --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,63 @@ +name: PR Check Pipeline + +on: + pull_request: + branches: [ master, dev ] + +jobs: + build: + runs-on: ubuntu-latest + environment: docker-build + + steps: + - uses: actions/checkout@v4 + + - name: Create env files + run: | + # Create mobile env file + cat << EOF > client_mobile/.env.mobile + VITE_PORT=${{ secrets.VITE_PORT }} + VITE_ENDPOINT=${{ secrets.VITE_ENDPOINT }} + VITE_GOOGLE_CLIENT_ID=${{ secrets.VITE_GOOGLE_CLIENT_ID }} + VITE_GOOGLE_CLIENT_SECRET=${{ secrets.VITE_GOOGLE_CLIENT_SECRET }} + VITE_MICROSOFT_CLIENT_ID=${{ secrets.VITE_MICROSOFT_CLIENT_ID }} + VITE_LINKEDIN_CLIENT_ID=${{ secrets.VITE_LINKEDIN_CLIENT_ID }} + VITE_LINKEDIN_CLIENT_SECRET=${{ secrets.VITE_LINKEDIN_CLIENT_SECRET }} + VITE_SPOTIFY_CLIENT_ID=${{ secrets.VITE_SPOTIFY_CLIENT_ID }} + VITE_SPOTIFY_CLIENT_SECRET=${{ secrets.VITE_SPOTIFY_CLIENT_SECRET }} + API_URL=${{ secrets.API_URL }} + WEB_CLIENT_URL=${{ secrets.WEB_CLIENT_URL }} + MOBILE_CLIENT_URL=${{ secrets.MOBILE_CLIENT_URL }} + GITHUB_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} + GITHUB_CLIENT_SECRET=${{ secrets.GH_CLIENT_SECRET }} + EOF + + # Create web env file + cat << EOF > client_web/.env.local + VITE_PORT=${{ secrets.VITE_PORT }} + VITE_ENDPOINT=${{ secrets.VITE_ENDPOINT }} + VITE_GOOGLE_CLIENT_ID=${{ secrets.VITE_GOOGLE_CLIENT_ID }} + VITE_GOOGLE_CLIENT_SECRET=${{ secrets.VITE_GOOGLE_CLIENT_SECRET }} + VITE_MICROSOFT_CLIENT_ID=${{ secrets.VITE_MICROSOFT_CLIENT_ID }} + VITE_LINKEDIN_CLIENT_ID=${{ secrets.VITE_LINKEDIN_CLIENT_ID }} + VITE_LINKEDIN_CLIENT_SECRET=${{ secrets.VITE_LINKEDIN_CLIENT_SECRET }} + VITE_SPOTIFY_CLIENT_ID=${{ secrets.VITE_SPOTIFY_CLIENT_ID }} + VITE_SPOTIFY_CLIENT_SECRET=${{ secrets.VITE_SPOTIFY_CLIENT_SECRET }} + API_URL=${{ secrets.API_URL }} + WEB_CLIENT_URL=${{ secrets.WEB_CLIENT_URL }} + MOBILE_CLIENT_URL=${{ secrets.MOBILE_CLIENT_URL }} + GITHUB_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} + GITHUB_CLIENT_SECRET=${{ secrets.GH_CLIENT_SECRET }} + EOF + + # Create root env file if needed + cat << EOF > .env + VITE_PORT=${{ secrets.VITE_PORT }} + EOF + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker images + run: | + docker compose build \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4a67b95 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,93 @@ +name: Create Release + +on: + push: + branches: [ master, cma/feat-ci-build-docker ] + +jobs: + release: + runs-on: ubuntu-latest + environment: docker-build + + steps: + - uses: actions/checkout@v4 + + - name: Create env files + run: | + # Create mobile env file + cat << EOF > client_mobile/.env.mobile + VITE_PORT=${{ secrets.VITE_PORT }} + VITE_ENDPOINT=${{ secrets.VITE_ENDPOINT }} + VITE_GOOGLE_CLIENT_ID=${{ secrets.VITE_GOOGLE_CLIENT_ID }} + VITE_GOOGLE_CLIENT_SECRET=${{ secrets.VITE_GOOGLE_CLIENT_SECRET }} + VITE_MICROSOFT_CLIENT_ID=${{ secrets.VITE_MICROSOFT_CLIENT_ID }} + VITE_LINKEDIN_CLIENT_ID=${{ secrets.VITE_LINKEDIN_CLIENT_ID }} + VITE_LINKEDIN_CLIENT_SECRET=${{ secrets.VITE_LINKEDIN_CLIENT_SECRET }} + VITE_SPOTIFY_CLIENT_ID=${{ secrets.VITE_SPOTIFY_CLIENT_ID }} + VITE_SPOTIFY_CLIENT_SECRET=${{ secrets.VITE_SPOTIFY_CLIENT_SECRET }} + API_URL=${{ secrets.API_URL }} + WEB_CLIENT_URL=${{ secrets.WEB_CLIENT_URL }} + MOBILE_CLIENT_URL=${{ secrets.MOBILE_CLIENT_URL }} + GITHUB_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} + GITHUB_CLIENT_SECRET=${{ secrets.GH_CLIENT_SECRET }} + EOF + + # Create web env file + cat << EOF > client_web/.env.local + VITE_PORT=${{ secrets.VITE_PORT }} + VITE_ENDPOINT=${{ secrets.VITE_ENDPOINT }} + VITE_GOOGLE_CLIENT_ID=${{ secrets.VITE_GOOGLE_CLIENT_ID }} + VITE_GOOGLE_CLIENT_SECRET=${{ secrets.VITE_GOOGLE_CLIENT_SECRET }} + VITE_MICROSOFT_CLIENT_ID=${{ secrets.VITE_MICROSOFT_CLIENT_ID }} + VITE_LINKEDIN_CLIENT_ID=${{ secrets.VITE_LINKEDIN_CLIENT_ID }} + VITE_LINKEDIN_CLIENT_SECRET=${{ secrets.VITE_LINKEDIN_CLIENT_SECRET }} + VITE_SPOTIFY_CLIENT_ID=${{ secrets.VITE_SPOTIFY_CLIENT_ID }} + VITE_SPOTIFY_CLIENT_SECRET=${{ secrets.VITE_SPOTIFY_CLIENT_SECRET }} + API_URL=${{ secrets.API_URL }} + WEB_CLIENT_URL=${{ secrets.WEB_CLIENT_URL }} + MOBILE_CLIENT_URL=${{ secrets.MOBILE_CLIENT_URL }} + GITHUB_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} + GITHUB_CLIENT_SECRET=${{ secrets.GH_CLIENT_SECRET }} + EOF + + # Create root env file if needed + cat << EOF > .env + VITE_PORT=${{ secrets.VITE_PORT }} + EOF + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker images + run: | + docker compose up --build -d + + - name: List Docker images + run: | + docker ps + + - name: Extract APK + run: | + mkdir -p artifacts + docker cp area-client-web:/usr/share/nginx/html/mobile_builds/client.apk ./artifacts/ + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ github.run_number }} + release_name: Release v${{ github.run_number }} + draft: false + prerelease: false + + - name: Upload Release APK + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./artifacts/client.apk + asset_name: area-mobile-v${{ github.run_number }}.apk + asset_content_type: application/vnd.android.package-archive \ No newline at end of file diff --git a/client_mobile/.gitignore b/client_mobile/.gitignore index 5b8e2b0..15a235e 100644 --- a/client_mobile/.gitignore +++ b/client_mobile/.gitignore @@ -30,6 +30,7 @@ migrate_working_dir/ .pub-cache/ .pub/ /build/ +pubspec.lock # Symbolication related app.*.symbols diff --git a/client_web/Dockerfile b/client_web/Dockerfile index 2d06b21..6f205e0 100644 --- a/client_web/Dockerfile +++ b/client_web/Dockerfile @@ -20,6 +20,9 @@ FROM node:latest AS builder WORKDIR /app +COPY --from=cert-builder /localhost.pem /app/localhost.pem +COPY --from=cert-builder /localhost-key.pem /app/localhost-key.pem + ARG VITE_PORT ARG VITE_ENDPOINT ARG VITE_GOOGLE_CLIENT_ID