Skip to content

Commit

Permalink
Merge pull request #4 from lyes-s/develop
Browse files Browse the repository at this point in the history
Lyes Sefiane | Professional Profile Update
  • Loading branch information
lyes-sefiane committed Mar 5, 2024
2 parents e5b77d2 + 8b6a966 commit dbc655d
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_LYES_SEFIANE }}'
channelId: live
projectId: lyes-sefiane
projectId: '${{ secrets.FIREBASE_PROJECT_ID_LYES_SEFIANE }}'
262 changes: 165 additions & 97 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,170 @@

* Website URL: https://lyes-sefiane.web.app

## Table Of Contents

* [Build and Publish Docker Image to DockerHub with GitHub Actions](#build-and-publish-docker-image-with-to-dockerhub-github-actions)
* [GitHub Actions: Docker Job Description](#github-action-docker-job-description)
* [Results](#results)

* [Deploy Static Website to Firebase Hosting with GitHub Actions](#deploy-static-website-to-firebase-hosting-with-github-actions)
* [GitHub Actions Generated by the Firebase CLI](#github-actions-generated-by-the-firebase-cli)
* [GitHub Actions: Firebase Deploy Job Description](#github-actions-generated-by-the-firebase-cli)

* [Localhost : Deploy with NGINX and Docker](#localhost-deploy-with-nginx-and-docker)
* [Build Docker Image](#build-docker-image)
* [NGINX and Docker](#nginx-and-docker)
* [URL](#url)

* [Deploy Static Website to Firebase Hosting with Firebase CLI](#deploy-static-website-to-firebase-hosting-with-firebase-cli)
* [Firebase CLI: Initialization and Deploy](#firebase-cli-initialization-and-deploy)
* [Firebase CLI: Login & Deploy](#firebase-cli-login--deploy)


## Build and Publish Docker Image to DockerHub with GitHub Actions

### GitHub Action Docker Job Description

```bash
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${{ secrets.IMAGE_TAG }}
```

### Results

<p align="center">
<img src="https://raw.githubusercontent.com/lyes-s/lyes-sefiane/main/images/docker-image-build.PNG">
</p>

<p align="center">
<img src="https://raw.githubusercontent.com/lyes-s/lyes-sefiane/main/images/docker-image-publish-to-dockerhub.PNG">
</p>


## Deploy Static Website to Firebase Hosting with GitHub Actions

### GitHub Actions Generated by the Firebase CLI

```bash
Lyes Sefiane@DESKTOP-EJF2R0S MINGW64 ~
$ firebase login --interactive
i Firebase optionally collects CLI and Emulator Suite usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.
? Allow Firebase to collect CLI and Emulator Suite usage and error reporting n
? Allow Firebase to collect CLI and Emulator Suite usage and error reporting
information? No
Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=625452047&redirect_uri=http%3A%2F%2Flocalhost%3A9005
Waiting for authentication...
+ Success! Logged in as [email protected]
Lyes Sefiane@DESKTOP-EJF2R0S MINGW64 ~
$ cd Documents/eclipse-workspace/lyes-sefiane
Lyes Sefiane@DESKTOP-EJF2R0S MINGW64 ~/Documents/eclipse-workspace/lyes-sefiane (main)
$ firebase init hosting:github
######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########
You're about to initialize a Firebase project in this directory:

C:\Users\Lyes Sefiane\Documents\eclipse-workspace\lyes-sefiane

Before we get started, keep in mind:

* You are initializing within an existing Firebase project directory

? Are you ready to proceed? (Y/n) y
? Are you ready to proceed? Yes

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

i Using project lyes-sefiane (lyes-sefiane)

=== Hosting:github Setup

i Detected a .git folder at C:\Users\Lyes Sefiane\Documents\eclipse-workspace\lyes-sefiane
i Authorizing with GitHub to upload your service account to a GitHub repository's secrets store.
Visit this URL on this device to log in:
https://github.com/login/oauth/authorize?client_id=89cf50f02ac6aaed3484&state=634400349&redirect_uri=http%3A%2F%2Flocalhost%3A9005&scope=read%3Auser%20repo%20public_repo
Waiting for authentication...
+ Success! Logged into GitHub as lyes-s
? For which GitHub repository would you like to set up a GitHub workflow? l
? For which GitHub repository would you like to set up a GitHub workflow?
- Retrieving a service account.s/lyes-sefiane
+ Created service account github-action-765964405 with Firebase Hosting admin permissions.
- Uploading service account secrets to repository: lyes-s/lyes-sefiane
+ Uploaded service account JSON to GitHub as secret FIREBASE_SERVICE_ACCOUNT_LYES_SEFIANE.
i You can manage your secrets at https://github.com/lyes-s/lyes-sefiane/settings/secrets.
? Set up the workflow to run a build script before every deploy? (y/N) y
? Set up the workflow to run a build script before every deploy? Yes
? What script should be run before every deploy? (npm ci && npm run build)
? What script should be run before every deploy? npm ci && npm run build
+ Created workflow file C:\Users\Lyes Sefiane\Documents\eclipse-workspace\lyes-sefiane\.github/workflows/firebase-hosting-pull-request.yml
? Set up automatic deployment to your site's live channel when a PR is merged?
? What is the name of the GitHub branch associated with your site's live
channel? main
+ Created workflow file C:\Users\Lyes Sefiane\Documents\eclipse-workspace\lyes-sefiane\.github/workflows/firebase-hosting-merge.yml
i Action required: Visit this URL to revoke authorization for the Firebase CLI GitHub OAuth App:
https://github.com/settings/connections/applications/89cf50f02ac6aaed3484
i Action required: Push any new workflow file(s) to your repo
i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
+ Firebase initialization complete!
Lyes Sefiane@DESKTOP-EJF2R0S MINGW64 ~/Documents/eclipse-workspace/lyes-sefiane (main)
```
### GitHub Action Firebase Deploy Job Description
```bash
firebase_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_LYES_SEFIANE }}'
channelId: live
projectId: '${{ secrets.FIREBASE_PROJECT_ID_LYES_SEFIANE }}'
```
## Localhost Deploy with NGINX and Docker
### Build Docker Image
Expand Down Expand Up @@ -94,8 +258,7 @@ e38b1fde5b2acba2dbdf29e27d7a09c92d27d2d27b8f261323d663c5dca409ea

* http://localhost:8080/

## Deploy to Firebase with Firebase CLI
## Deploy Static Website to Firebase Hosting with Firebase CLI

### Firebase CLI: Initialization and Deploy

Expand Down Expand Up @@ -220,101 +383,6 @@ $ firebase logout

```
## Deploy to Firebase with GitHub Actions
```bash
Lyes Sefiane@DESKTOP-EJF2R0S MINGW64 ~
$ firebase login --interactive
i Firebase optionally collects CLI and Emulator Suite usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.

? Allow Firebase to collect CLI and Emulator Suite usage and error reporting n
? Allow Firebase to collect CLI and Emulator Suite usage and error reporting
information? No

Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=625452047&redirect_uri=http%3A%2F%2Flocalhost%3A9005

Waiting for authentication...

+ Success! Logged in as [email protected]

Lyes Sefiane@DESKTOP-EJF2R0S MINGW64 ~
$ cd Documents/eclipse-workspace/lyes-sefiane

Lyes Sefiane@DESKTOP-EJF2R0S MINGW64 ~/Documents/eclipse-workspace/lyes-sefiane (main)
$ firebase init hosting:github

######## #### ######## ######## ######## ### ###### ########
## ## ## ## ## ## ## ## ## ## ##
###### ## ######## ###### ######## ######### ###### ######
## ## ## ## ## ## ## ## ## ## ##
## #### ## ## ######## ######## ## ## ###### ########

You're about to initialize a Firebase project in this directory:
C:\Users\Lyes Sefiane\Documents\eclipse-workspace\lyes-sefiane
Before we get started, keep in mind:
* You are initializing within an existing Firebase project directory
? Are you ready to proceed? (Y/n) y
? Are you ready to proceed? Yes
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
i Using project lyes-sefiane (lyes-sefiane)
=== Hosting:github Setup
i Detected a .git folder at C:\Users\Lyes Sefiane\Documents\eclipse-workspace\lyes-sefiane
i Authorizing with GitHub to upload your service account to a GitHub repository's secrets store.

Visit this URL on this device to log in:
https://github.com/login/oauth/authorize?client_id=89cf50f02ac6aaed3484&state=634400349&redirect_uri=http%3A%2F%2Flocalhost%3A9005&scope=read%3Auser%20repo%20public_repo

Waiting for authentication...

+ Success! Logged into GitHub as lyes-s

? For which GitHub repository would you like to set up a GitHub workflow? l
? For which GitHub repository would you like to set up a GitHub workflow?
- Retrieving a service account.s/lyes-sefiane

+ Created service account github-action-765964405 with Firebase Hosting admin permissions.
- Uploading service account secrets to repository: lyes-s/lyes-sefiane
+ Uploaded service account JSON to GitHub as secret FIREBASE_SERVICE_ACCOUNT_LYES_SEFIANE.
i You can manage your secrets at https://github.com/lyes-s/lyes-sefiane/settings/secrets.

? Set up the workflow to run a build script before every deploy? (y/N) y
? Set up the workflow to run a build script before every deploy? Yes
? What script should be run before every deploy? (npm ci && npm run build)
? What script should be run before every deploy? npm ci && npm run build

+ Created workflow file C:\Users\Lyes Sefiane\Documents\eclipse-workspace\lyes-sefiane\.github/workflows/firebase-hosting-pull-request.yml
? Set up automatic deployment to your site's live channel when a PR is merged?
? What is the name of the GitHub branch associated with your site's live
channel? main
+ Created workflow file C:\Users\Lyes Sefiane\Documents\eclipse-workspace\lyes-sefiane\.github/workflows/firebase-hosting-merge.yml

i Action required: Visit this URL to revoke authorization for the Firebase CLI GitHub OAuth App:
https://github.com/settings/connections/applications/89cf50f02ac6aaed3484
i Action required: Push any new workflow file(s) to your repo

i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...

+ Firebase initialization complete!

Lyes Sefiane@DESKTOP-EJF2R0S MINGW64 ~/Documents/eclipse-workspace/lyes-sefiane (main)
```


## Contributing
Pull requests are welcome.
Expand Down
Binary file added images/docker-image-build.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/docker-image-publish-to-dockerhub.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/github-actions-on-merge.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dbc655d

Please sign in to comment.