-
Notifications
You must be signed in to change notification settings - Fork 2
Add Google OAuth login and GAR CI/CD pipeline #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: Build and Push to Google Artifact Registry | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Create .version file | ||
| env: | ||
| REF_TYPE: ${{ github.ref_type }} | ||
| REF_NAME: ${{ github.ref_name }} | ||
| COMMIT_SHA: ${{ github.sha }} | ||
| run: | | ||
| if [[ "${REF_TYPE}" == "tag" ]]; then | ||
| echo "${REF_NAME}" > .version | ||
| else | ||
| echo "${COMMIT_SHA}" > .version | ||
| fi | ||
|
|
||
| - name: Authenticate to Google Cloud | ||
| id: auth | ||
| uses: google-github-actions/auth@v2 | ||
| with: | ||
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | ||
| token_format: access_token | ||
|
|
||
| - name: Login to Artifact Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: us-central1-docker.pkg.dev | ||
| username: oauth2accesstoken | ||
| password: ${{ steps.auth.outputs.access_token }} | ||
|
|
||
| - name: Docker meta | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: us-central1-docker.pkg.dev/kencove-prod/docuseal/docuseal | ||
| tags: | | ||
| type=semver,pattern={{version}} | ||
| type=sha,prefix=,format=short | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
|
Comment on lines
+55
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: In That means on a tag push run ( If your goal is “push
If your goal is “push
Finally, while Citations:
The When this workflow is triggered by a tag push, If you want
🤖 Prompt for AI Agents |
||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| push: true | ||
| platforms: linux/amd64 | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class OmniauthCallbacksController < Devise::OmniauthCallbacksController | ||
| skip_before_action :verify_authenticity_token, only: :google_oauth2 | ||
|
|
||
| def google_oauth2 | ||
| user = Users.from_omniauth(request.env['omniauth.auth']) | ||
|
|
||
| if user&.active_for_authentication? | ||
| sign_in_and_redirect(user, event: :authentication) | ||
| else | ||
| redirect_to new_user_session_path, alert: I18n.t('user_not_found') | ||
| end | ||
| end | ||
|
|
||
| def failure | ||
| redirect_to new_user_session_path, alert: I18n.t('authentication_failed') | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,6 +173,8 @@ en: &en | |
| sign_in: Sign In | ||
| signing_in: Signing In | ||
| sign_in_with_microsoft: Sign in with Microsoft | ||
| user_not_found: User not found. Please contact your administrator. | ||
| authentication_failed: Authentication failed. Please try again. | ||
|
Comment on lines
+176
to
+177
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add translations for non‑English locales. These new keys are only present in 🤖 Prompt for AI Agents |
||
| sign_in_with_google: Sign in with Google | ||
| forgot_your_password_: Forgot your password? | ||
| create_free_account: Create free account | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Users | ||
| module_function | ||
|
|
||
| def from_omniauth(oauth) | ||
| User.find_by(email: oauth.info.email.to_s.downcase) | ||
| end | ||
| end |
Uh oh!
There was an error while loading. Please reload this page.