Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 50 additions & 4 deletions .github/workflows/practical_email_management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
- name: Test
run: |
echo "Not yet implemented"
push-feature:
name: Push feature
push-feature-dev:
name: Push feature - DEV
runs-on: ubuntu-latest
if: startsWith(github.ref,'refs/heads/feat/')
if: startsWith(github.ref,'refs/heads/feat/') && github.steps.flags.output.skip_cd == 'false'
needs: [test, initialize]
steps:
- name: Setup
Expand All @@ -69,8 +69,9 @@ jobs:
env:
GOOGLE_APP_SCRIPT_CREDENTIALS: ${{ secrets.GOOGLE_CLASP_CREDENTIALS }}
publish-dev:
name: Public development
name: Publish development - DEV
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
needs: [test, initialize]
steps:
- name: Setup
Expand All @@ -81,4 +82,49 @@ jobs:
npm install
- name: Publish
run: |
echo $DEPLOYMENT_ID > deploy_id.txt
echo "Not yet implemented"
env:
DEPLOYMENT_ID: ${{ secrets.PRACTICAL_EMAIL_MANAGEMENT_DEPLOYMENT_ID_DEV }}
push-feature-prod:
name: Push feature - PROD
runs-on: ubuntu-latest
if: startsWith(github.ref,'refs/heads/release/') && github.steps.flags.output.skip_cd == 'false'
needs: [test, initialize]
steps:
- name: Setup
uses: actions/checkout@v3
- name: Build
working-directory: PracticalEmailManagement
run: |
npm install
jq --null-input -c \
--arg scriptId "$SCRIPT_ID" \
'{"scriptId": $scriptId}' > .clasp.json
npm run build
env:
SCRIPT_ID: ${{ secrets.PRACTICAL_EMAIL_MANAGEMENT_PROD_ID }}
- name: deploy
working-directory: PracticalEmailManagement
run: |
echo $GOOGLE_APP_SCRIPT_CREDENTIALS > /home/runner/.clasprc.json
npm run push
env:
GOOGLE_APP_SCRIPT_CREDENTIALS: ${{ secrets.GOOGLE_CLASP_CREDENTIALS }}
publish-prod:
name: Publish development - PROD
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [test, initialize]
steps:
- name: Setup
uses: actions/checkout@v3
- name: Build
working-directory: PracticalEmailManagement
run: |
npm install
- name: Publish
run: |
echo $DEPLOYMENT_ID > deploy_id.txt
env:
DEPLOYMENT_ID: ${{ secrets.PRACTICAL_EMAIL_MANAGEMENT_DEPLOYMENT_ID_PROD }}
2 changes: 2 additions & 0 deletions PracticalEmailManagement/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.clasp.json
.clasp.dev.json
.clasp.prod.json
build/
18 changes: 18 additions & 0 deletions PracticalEmailManagement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Reference: https://site.robaone.com/blog/practical-email-management
- [Practical Email Management](#practical-email-management)
- [Context](#context)
- [Developer Workspace Setup](#developer-workspace-setup)
- [Deployment workflow](#deployment-workflow)
# Context

This project is intended to be used in Google GMail only and is incompatible with other email services.
Expand All @@ -19,3 +20,20 @@ This project is intended to be used in Google GMail only and is incompatible wit
5. Move the `.clasp.json` file from the `src` folder to this folder.
6. Push the code with the command, `npx clasp push`.
7. Copy the `scriptId` from the `.clasp.json` file and store it on the GitHub Secret, `PRACTICAL_EMAIL_MANAGEMENT_DEV_ID`
8. Navigate to the Apps Script project in https://script.google.com
9. Press the `Deploy` button and the `New deployment` option.
10. Beside `Select type` press the Gear icon and choose `web app`.
11. Set description as `DEV`, Execute as `Me` and Who has access as `Only myself`.
12. Press `Deploy`.
13. Copy the deployment id and store it on the GitHub secret, `PRACTICAL_EMAIL_MANAGEMENT_DEPLOYMENT_ID_DEV`.
14. Copy the `.clasp.json` file to `.clasp.dev.json`
15. Create a new script by typing the following command from this folder. `npx clasp create --type "web app" --title "PracticalEmailManagement-PROD" --rootDir src`
16. Move the file `src/.clasp.json` to `.clasp.prod.json`.
17. Copy the `scriptId` from the `.clasp.prod.json` file and store it on the GitHub Secret, `PRACTICAL_EMAIL_MANAGEMENT_PROD_ID`.

## Deployment workflow

- A feature branch will push code to the DEV project
- Merging to develop will publish code to the DEV project
- A release branch will push code to the PROD project
- Merging to the main branch will publish code to the PROD project
Loading