-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(github-workflows): add ci for pr build check and for release bui…
…ld and deployment Signed-off-by: Charles Madjeri <[email protected]>
- Loading branch information
Charles Madjeri
committed
Dec 3, 2024
1 parent
4963872
commit 8dbd2c6
Showing
3 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
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 mobile container | ||
run: | | ||
docker compose build | ||
- name: Extract APK | ||
run: | | ||
mkdir -p artifacts | ||
docker create --name mobile_container area-client-mobile | ||
docker cp mobile_container:/app/build/app/outputs/flutter-apk/client.apk ./artifacts/ | ||
docker rm mobile_container | ||
- 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 |
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