From 131d33acd8d40e39dc9adda29d755d068af2e5bf Mon Sep 17 00:00:00 2001 From: viphan007 Date: Fri, 1 Dec 2023 09:08:24 +0700 Subject: [PATCH 1/2] Setup MetaMask staging repo --- .github/ISSUE_TEMPLATE/metamask.md | 2 +- .github/workflows/auto-assign.yml | 43 ++++++++++++++++++++++++++++++ .github/workflows/integrate.yml | 41 +++++++++++++++------------- README.md | 2 +- gatsby-config.js | 4 +-- package.json | 3 ++- 6 files changed, 72 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/auto-assign.yml diff --git a/.github/ISSUE_TEMPLATE/metamask.md b/.github/ISSUE_TEMPLATE/metamask.md index a434fbee22c..e567beff671 100644 --- a/.github/ISSUE_TEMPLATE/metamask.md +++ b/.github/ISSUE_TEMPLATE/metamask.md @@ -3,7 +3,7 @@ name: Metamask Request about: Request regarding Metamask.io for the Website Team title: "[Metamask]" labels: 'metamask,' -assignees: cuonglt-ync, jlazoff, dcpnlau, SunnySian, SaraCheikh, nkkurt +assignees: cuonglt-ync, jlazoff, dcpnlau, SaraCheikh, nkkurt --- **YNC:** (Internal Use Only - Ignore) diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml new file mode 100644 index 00000000000..60f01c8bccf --- /dev/null +++ b/.github/workflows/auto-assign.yml @@ -0,0 +1,43 @@ +name: Auto assign on PR and issue created + +on: + issues: + types: [opened, reopened] + pull_request: + types: [opened, reopened] + branches: [main] + +jobs: + assign-pr-and-issue: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + repository-projects: read + steps: + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: ${{ github.event.repository.name }} + + - name: Assign PR + if: github.event.pull_request.number + run: | + gh pr edit "$NUMBER" --add-assignee jlazoff --add-assignee cuonglt-ync --add-assignee kevin-chassagne --add-assignee dcpnlau --add-assignee SaraCheikh --add-reviewer tannn-younet --add-reviewer viphan007 + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + NUMBER: ${{ github.event.pull_request.number }} + GH_REPO: ${{ github.repository }} + + - name: Assign ISSUE + if: github.event.issue.number + run: | + gh issue edit "$NUMBER" --add-assignee jlazoff --add-assignee nkkurt --add-assignee cuonglt-ync --add-assignee kevin-chassagne + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} + NUMBER: ${{ github.event.issue.number }} + GH_REPO: ${{ github.repository }} \ No newline at end of file diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index 3e8e237b820..6838ccb5977 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -21,22 +21,22 @@ jobs: with: persist-credentials: false - - name: Create production env file + - name: Create env file run: | - touch gatsby.production.env - echo GATSBY_CONTENTFUL_API_KEY =${{ secrets.GATSBY_CONTENTFUL_API_KEY }} >> gatsby.production.env - echo GATSBY_CONTENTFUL_DOWNLOAD_LOCAL =${{ secrets.GATSBY_CONTENTFUL_DOWNLOAD_LOCAL }} >> gatsby.production.env - echo GATSBY_CONTENTFUL_ENVIRONMENT =${{ secrets.GATSBY_CONTENTFUL_ENVIRONMENT }} >> gatsby.production.env - echo GATSBY_CONTENTFUL_HOST =${{ secrets.GATSBY_CONTENTFUL_HOST }} >> gatsby.production.env - echo GATSBY_CONTENTFUL_SPACE_ID =${{ secrets.GATSBY_CONTENTFUL_SPACE_ID }} >> gatsby.production.env - echo GATSBY_GA_ID =${{ secrets.GATSBY_GA_ID }} >> gatsby.production.env - echo GATSBY_GTM_ID =${{ secrets.GATSBY_GTM_ID }} >> gatsby.production.env - echo GATSBY_CONSENSYS_HOST =${{ secrets.GATSBY_CONSENSYS_HOST }} >> gatsby.production.env - echo GATSBY_CONTENTFUL_PREVIEW_HOST =${{ secrets.GATSBY_CONTENTFUL_PREVIEW_HOST }} >> gatsby.production.env - echo GATSBY_CONTENTFUL_PREVIEW_API_KEY =${{ secrets.GATSBY_CONTENTFUL_PREVIEW_API_KEY }} >> gatsby.production.env - echo GATSBY_OSANO_CUSTOMER_ID =${{ secrets.GATSBY_OSANO_CUSTOMER_ID }} >> gatsby.production.env - echo GATSBY_OSANO_CCID_ID =${{ secrets.GATSBY_OSANO_CCID_ID }} >> gatsby.production.env - echo GH_TOKEN =${{ secrets.GH_TOKEN }} >> gatsby.production.env + touch .env + echo GATSBY_CONTENTFUL_API_KEY=${{ secrets.GATSBY_CONTENTFUL_API_KEY }} >> .env + echo GATSBY_CONTENTFUL_DOWNLOAD_LOCAL=${{ secrets.GATSBY_CONTENTFUL_DOWNLOAD_LOCAL }} >> .env + echo GATSBY_CONTENTFUL_ENVIRONMENT=${{ secrets.GATSBY_CONTENTFUL_ENVIRONMENT }} >> .env + echo GATSBY_CONTENTFUL_HOST=${{ secrets.GATSBY_CONTENTFUL_HOST }} >> .env + echo GATSBY_CONTENTFUL_SPACE_ID=${{ secrets.GATSBY_CONTENTFUL_SPACE_ID }} >> .env + echo GATSBY_GA_ID=${{ secrets.GATSBY_GA_ID }} >> .env + echo GATSBY_GTM_ID=${{ secrets.GATSBY_GTM_ID }} >> .env + echo GATSBY_CONSENSYS_HOST=${{ secrets.GATSBY_CONSENSYS_HOST }} >> .env + echo GATSBY_CONTENTFUL_PREVIEW_HOST=${{ secrets.GATSBY_CONTENTFUL_PREVIEW_HOST }} >> .env + echo GATSBY_CONTENTFUL_PREVIEW_API_KEY=${{ secrets.GATSBY_CONTENTFUL_PREVIEW_API_KEY }} >> .env + echo GATSBY_OSANO_CUSTOMER_ID=${{ secrets.GATSBY_OSANO_CUSTOMER_ID }} >> .env + echo GATSBY_OSANO_CCID_ID=${{ secrets.GATSBY_OSANO_CCID_ID }} >> .env + echo GH_TOKEN=${{ secrets.GH_TOKEN }} >> .env - name: Read .nvmrc run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" @@ -48,7 +48,12 @@ jobs: node-version: "${{ steps.nvm.outputs.NVMRC }}" - run: | yarn - yarn deploy + if [ ${{ vars.IS_STAGING == 'true' }} ]; then + yarn deploy:dev + else + yarn deploy + fi + env: CI: true @@ -56,5 +61,5 @@ jobs: uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_branch: gh-pages # The branch the action should deploy to. - publish_dir: ./public # The folder the action should deploy. + publish_branch: gh-pages + publish_dir: ./public diff --git a/README.md b/README.md index 5d35064b9b8..d51e7f4acba 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Built With: ├── ... ├── html.js ├── gatsby-config.js - ├── gatsby.[development].env] + ├── .env ├── GraphQL_Query_Documentation.md ├── package.json └── README.md diff --git a/gatsby-config.js b/gatsby-config.js index 9569aec84e8..c1cb1535907 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,7 +1,7 @@ const activeEnv = process.env.ACTIVE_ENV || process.env.NODE_ENV || 'development' const envConfig = { - path: `${__dirname}/gatsby.${activeEnv}.env`, + path: `${__dirname}/.env`, } const env = require('dotenv').config(envConfig) @@ -13,7 +13,7 @@ if (env.errors) { module.exports = { siteMetadata: { title: 'MetaMask', - description: `MetaMask is a ConsenSys Formation.`, + description: `MetaMask is a Consensys Formation.`, siteUrl: activeEnv === 'development' ? 'https://metamask.consensys.io' diff --git a/package.json b/package.json index 1fceacbff77..1567f1830ab 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,14 @@ "name": "metamask-io", "description": "Website of MetaMask", "version": "2.0.0", - "author": "MetaMask • A ConsenSys Formation", + "author": "MetaMask • A Consensys Formation", "license": "MIT", "scripts": { "dev": "gatsby develop", "build": "gatsby build", "deploy": "yarn build && touch public/.nojekyll && touch public/CNAME && echo \"metamask.io\" >> public/CNAME", "build:dev": "ACTIVE_ENV=development gatsby build", + "deploy:dev": "yarn build:dev && touch public/.nojekyll && touch public/CNAME && echo \"metamask.consensys.io\" >> public/CNAME", "serve": "gatsby serve --port 8000", "clean": "rm -rf node_modules; rm -rf .cache; rm -rf public; yarn install;", "start": "yarn develop", From 6d39cccb47a19588eaa6f3dcbdb67b8d80caeb45 Mon Sep 17 00:00:00 2001 From: viphan007 Date: Fri, 1 Dec 2023 15:47:27 +0700 Subject: [PATCH 2/2] Remove auto assign workflow --- .github/workflows/auto-assign.yml | 43 ------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 .github/workflows/auto-assign.yml diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml deleted file mode 100644 index 60f01c8bccf..00000000000 --- a/.github/workflows/auto-assign.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Auto assign on PR and issue created - -on: - issues: - types: [opened, reopened] - pull_request: - types: [opened, reopened] - branches: [main] - -jobs: - assign-pr-and-issue: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - repository-projects: read - steps: - - name: Generate a token - id: generate_token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - owner: ${{ github.repository_owner }} - repositories: ${{ github.event.repository.name }} - - - name: Assign PR - if: github.event.pull_request.number - run: | - gh pr edit "$NUMBER" --add-assignee jlazoff --add-assignee cuonglt-ync --add-assignee kevin-chassagne --add-assignee dcpnlau --add-assignee SaraCheikh --add-reviewer tannn-younet --add-reviewer viphan007 - env: - GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - NUMBER: ${{ github.event.pull_request.number }} - GH_REPO: ${{ github.repository }} - - - name: Assign ISSUE - if: github.event.issue.number - run: | - gh issue edit "$NUMBER" --add-assignee jlazoff --add-assignee nkkurt --add-assignee cuonglt-ync --add-assignee kevin-chassagne - env: - GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - NUMBER: ${{ github.event.issue.number }} - GH_REPO: ${{ github.repository }} \ No newline at end of file