Skip to content

Commit

Permalink
Feature/context menu (#253)
Browse files Browse the repository at this point in the history
* Fixed context menu options

* updated repo url

* removing cloud access

* removed cloud distribution

* updated code to remove cloud

* added no cloud

* try again

* another

* Changes command

* npm setup

* npx

* try again

* ci

* updated release yml

* format changes
  • Loading branch information
dharmesh-hemaram authored Apr 29, 2024
1 parent 97db393 commit 09aec64
Show file tree
Hide file tree
Showing 16 changed files with 915 additions and 3,099 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/close-inactive-issues.yml

This file was deleted.

169 changes: 169 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: mono-repo [release]
run-name: Deploy to ${{ inputs.environment }} by @${{ github.actor }}

on:
workflow_dispatch:
inputs:
environment:
description: 'Environment of release'
type: environment
default: Development
required: true
deploy_web:
description: 'Deploy web to azure static'
type: boolean
default: false
required: true
upload_extension:
description: 'Upload extension to chrome webstore'
type: boolean
default: false
required: true
publish:
description: 'Publish extension'
type: boolean
default: false
required: true

jobs:
main:
name: Nx Main Job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm ci
- name: build
run: npx nx run-many --target=build --parallel=3 --exclude='tag:puppeteer' --prod --base-href ${{vars.PUBLIC_URL}}
env:
NX_NAME: ${{vars.NX_NAME}}
NX_VARIANT: ${{vars.NX_VARIANT}}
NX_CHROME_EXTENSION_ID: ${{vars.NX_CHROME_EXTENSION_ID}}
NX_EDGE_EXTENSION_ID: ${{vars.NX_EDGE_EXTENSION_ID || 'DEV'}}
NX_I18N: ${{vars.NX_I18N}}
NX_GOOGLE_ANALYTICS_ID: ${{vars.NX_GOOGLE_ANALYTICS_ID}}
NX_GOOGLE_ADS_SLOT: ${{vars.NX_GOOGLE_ADS_SLOT}}
NX_GOOGLE_ADS_CLIENT: ${{vars.NX_GOOGLE_ADS_CLIENT}}
UNINSTALL_URL: ${{vars.UNINSTALL_URL}}
TRACKING_ID: ${{vars.TRACKING_ID}}
FUNCTION_URL: ${{vars.FUNCTION_URL}}
DISCORD_CLIENT_ID: ${{vars.DISCORD_CLIENT_ID}}
OAUTH_CLIENT_ID: ${{vars.OAUTH_CLIENT_ID}}
PUBLIC_URL: ${{vars.PUBLIC_URL}}
NX_RELEASE_VERSION: ${{github.ref_name}}
API_SECRET: ${{vars.API_SECRET}}
MEASUREMENT_ID: ${{vars.MEASUREMENT_ID}}
SENTRY_AUTH_TOKEN: ${{vars.SENTRY_AUTH_TOKEN}}
- name: bundle
run: |
npx web-ext build --sourceDir="./dist/apps/acf-extension" --artifactsDir="./dist/apps"
cd dist/apps
zip -r acf-options-page.zip acf-options-page/
zip -r acf-i18n.zip acf-i18n/
- uses: actions/upload-artifact@v4
with:
name: nx-main-artifacts
path: dist/apps/*

release:
needs: [main]
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
name: Release
outputs:
release-url: ${{ steps.release.outputs.url }}
release-id: ${{ steps.release.outputs.id }}
release-upload_url: ${{ steps.release.outputs.upload_url }}
release-assets: ${{ steps.release.outputs.assets }}
steps:
- uses: actions/download-artifact@v3
with:
name: nx-main-artifacts
- uses: softprops/action-gh-release@v1
if: ${{ hashFiles('auto_clicker_-_autofill*.zip') }}
id: release
with:
prerelease: ${{ vars.NX_VARIANT == 'BETA' || vars.NX_VARIANT == 'DEV'}}
generate_release_notes: true
discussion_category_name: 'Release'
files: |
auto_clicker_-_autofill*.zip
acf-i18n.zip
acf-options-page.zip
fail_on_unmatched_files: true

extension:
if: ${{ inputs.upload_extension }}
name: Upload Extension
needs: [release]
runs-on: ubuntu-latest
environment:
name: ${{inputs.environment}}
url: ${{needs.release.outputs.release-url}}
steps:
- uses: actions/download-artifact@v3
with:
name: nx-main-artifacts
- name: Upload & release
uses: mnao305/chrome-extension-upload@v4.0.1
with:
file-path: auto_clicker_-_autofill*.zip
extension-id: ${{ vars.NX_CHROME_EXTENSION_ID }}
client-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
refresh-token: ${{ secrets.REFRESH_TOKEN }}
publish: ${{inputs.publish}}
glob: true

web:
if: ${{ inputs.deploy_web }}
name: Deploy Web
needs: [release]
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
environment:
name: ${{inputs.environment}}
url: ${{vars.PUBLIC_URL}}
steps:
- uses: actions/download-artifact@v3
with:
name: nx-main-artifacts
- name: Build And Deploy
if: ${{ hashFiles('acf-options-page/') != '' }}
id: deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: 'upload'
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: 'acf-options-page' # App source code path
api_location: '' # Api source code path - optional
skip_app_build: true
skip_api_build: true
output_location: '' # Built app content directory - optional
###### End of Repository/Build Configurations ######

tag:
needs: [extension, web]
name: Create release tag
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set ${{vars.NX_VARIANT}} Tag
uses: rickstaa/action-create-tag@v1
with:
force_push_tag: true
tag: '${{vars.NX_VARIANT}}'
51 changes: 24 additions & 27 deletions .github/workflows/push-feature.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
name: feature [push]

on:
push:
branches:
- 'feature/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
pull_request:

jobs:
main:
name: Nx Cloud - Main Job
uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.14.0
secrets:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
with:
parallel-commands: |
npx nx-cloud record -- npx nx format:check
parallel-commands-on-agents: |
npx nx affected --target=lint --parallel=3
npx nx affected --target=test --parallel=3 --exclude='tag:puppeteer' --ci --code-coverage
agents:
name: Nx Cloud - Agents
uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.14.0
secrets:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
with:
number-of-agents: 3
runs-on: ubuntu-latest
permissions:
contents: 'read'
actions: 'read'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- uses: nrwl/nx-set-shas@v3
- run: |
echo "BASE: ${{ env.NX_BASE }}"
echo "HEAD: ${{ env.NX_HEAD }}"
# This line is needed for nx affected to work when CI is running on a PR
- run: git branch --track main origin/main
if: ${{ github.event_name == 'pull_request' }}
- run: npm ci
- run: npx nx format:check
- run: npx nx affected --target=lint --parallel=3
- run: npx nx affected --target=test --parallel=3 --exclude='tag:puppeteer' --ci --code-coverage
2 changes: 1 addition & 1 deletion .github/workflows/tags.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: mono-repo [release]
name: mono-repo [release] [tags]
run-name: Deploy to ${{ inputs.environment }} by @${{ github.actor }}

on:
Expand Down
2 changes: 0 additions & 2 deletions apps/acf-extension/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
],
"styles": ["apps/acf-extension/src/wizard/popup/wizard-popup.scss", "apps/acf-extension/src/content_scripts/status/status.scss"],
"tsConfig": "apps/acf-extension/tsconfig.app.json",
"isolatedConfig": true,
"webpackConfig": "apps/acf-extension/webpack.config.js"
},
"configurations": {
Expand Down Expand Up @@ -79,7 +78,6 @@
],
"styles": ["apps/acf-extension/src/wizard/popup/wizard-popup.scss", "apps/acf-extension/src/content_scripts/status/status.scss"],
"tsConfig": "apps/acf-extension/tsconfig.app.json",
"isolatedConfig": true,
"webpackConfig": "apps/acf-extension/webpack.config.js"
},
"configurations": {
Expand Down
7 changes: 4 additions & 3 deletions apps/acf-extension/src/background/context-menu.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { LOCAL_STORAGE_KEY } from '@dhruv-techapps/acf-common';
import { ACTION_POPUP, CONTEXT_MENU_CONFIG_PAGE_ID, CONTEXT_MENU_ELEMENT_ID } from '../common/constant';
import { GoogleAnalytics } from './google-analytics';

export default function registerContextMenus(optionsPageUrl?: string, googleAnalytics?: GoogleAnalytics) {
chrome.contextMenus.removeAll();
chrome.contextMenus.create({ id: CONTEXT_MENU_ELEMENT_ID, title: '★ Configure for this Field', contexts: ['page'] });
chrome.contextMenus.create({ id: ACTION_POPUP, title: '☉ Auto Clicker (Record)', contexts: ['page'] });
chrome.contextMenus.create({ id: 'CONFIG-SEPARATOR', type: 'separator', contexts: ['page'] });
chrome.contextMenus.create({ id: CONTEXT_MENU_ELEMENT_ID, title: '★ Configure for this Field', contexts: ['page', 'frame', 'selection', 'link', 'editable', 'image', 'video', 'audio', 'video'] });
chrome.contextMenus.create({ id: ACTION_POPUP, title: '☉ Auto Clicker (Record)', contexts: ['page', 'frame', 'selection', 'link', 'editable', 'image', 'video', 'audio', 'video'] });
chrome.contextMenus.create({ id: 'CONFIG-SEPARATOR', type: 'separator', contexts: ['page', 'frame', 'selection', 'link', 'editable', 'image', 'video', 'audio', 'video'] });
chrome.contextMenus.create({ id: CONTEXT_MENU_CONFIG_PAGE_ID, title: '↗ Open Configuration Page', contexts: ['all'] });

if (optionsPageUrl) {
Expand Down
1 change: 1 addition & 0 deletions apps/acf-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
}
],
"compilerOptions": {
"composite": true,
"esModuleInterop": true,
"allowJs": false,
"resolveJsonModule": true,
Expand Down
1 change: 0 additions & 1 deletion apps/acf-i18n/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"main": "apps/acf-i18n/src/main.ts",
"tsConfig": "apps/acf-i18n/tsconfig.app.json",
"assets": ["apps/acf-i18n/src/locales"],
"isolatedConfig": true,
"webpackConfig": "apps/acf-i18n/webpack.config.js"
},
"configurations": {
Expand Down
1 change: 0 additions & 1 deletion apps/acf-options-page/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"assets": ["apps/acf-options-page/src/favicon.ico", "apps/acf-options-page/src/manifest.json", "apps/acf-options-page/src/assets", "apps/acf-options-page/src/staticwebapp.config.json"],
"styles": ["apps/acf-options-page/src/styles.scss"],
"scripts": [],
"isolatedConfig": true,
"webpackConfig": "apps/acf-options-page/webpack.config.js"
},
"configurations": {
Expand Down
6 changes: 3 additions & 3 deletions apps/acf-options-page/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export const APP_LINK = {
BLOG: 'https://blog.getautoclicker.com/',
CONFIGS: 'https://gist.github.com/dharmesh-hemaram',
TEST: 'https://test.getautoclicker.com/',
ISSUES: 'https://github.com/Dhruv-Techapps/auto-clicker-auto-fill/issues',
DISCUSSIONS: 'https://github.com/Dhruv-Techapps/auto-clicker-auto-fill/discussions',
ISSUES: 'https://github.com/Dhruv-Techapps/acf-docs/issues',
DISCUSSIONS: 'https://github.com/Dhruv-Techapps/acf-docs/discussions',
};
// Application Languages
export const APP_LANGUAGES = ['en', 'ko', 'fr', 'zh-cn'];
Expand Down Expand Up @@ -39,7 +39,7 @@ export const SOCIAL_LINKS = {
DISCORD: 'https://discord.gg/ubMBeX3',
GOOGLE_GROUP: 'https://groups.google.com/g/auto-clicker-autofill',
TWITTER: `https://twitter.com/intent/tweet?text=${message}&url=${url}`,
GITHUB: 'https://github.com/Dhruv-Techapps/auto-clicker-auto-fill',
GITHUB: 'https://github.com/Dhruv-Techapps/acf-docs',
FACEBOOK: `https://www.facebook.com/sharer.php?u=${url}&quote=${message}`,
WHATSAPP: `https://wa.me/?text=${message}%5Cn%20${url}`,
RATE_US: `https://chromewebstore.google.com/detail/${extensionId}/reviews`,
Expand Down
2 changes: 1 addition & 1 deletion apps/acf-options-page/src/store/blog/blog.api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createAsyncThunk } from '@reduxjs/toolkit';

export const blogCheckAPI = createAsyncThunk('blog/check', async (version: string) => {
const response = await fetch(`https://api.github.com/repos/Dhruv-Techapps/auto-clicker-auto-fill/releases/tags/v${version}`);
const response = await fetch(`https://api.github.com/repos/Dhruv-Techapps/acf-docs/releases/tags/v${version}`);
if (response.status === 200) {
const release = await response.json();
return release;
Expand Down
Loading

0 comments on commit 09aec64

Please sign in to comment.