diff --git a/.env.ci b/.env.ci new file mode 100644 index 0000000..b3572d9 --- /dev/null +++ b/.env.ci @@ -0,0 +1,8 @@ +#/-------------------[DOTENV_PUBLIC_KEY]--------------------/ +#/ public-key encryption for .env files / +#/ [how it works](https://dotenvx.com/encryption) / +#/----------------------------------------------------------/ +DOTENV_PUBLIC_KEY_CI="032a51442afd8a5d812af70bc50eb1554956396a8d5c74fdbd212d18d7e07c572b" + +# .env.ci +WRANGLER_DEPLOY_TOKEN="encrypted:BGcbpCtCZ4LFf0fWg+SH/2JGXIH3bTwrKETqVAKWL8tUvyOekj81BouL726kXGkpPXs5yn9+MmM4mcwodO2qy50xU78dy5G7fVmqpkhv75b5EE86VkfZWgLqVE4vvl3JmCv2U9h+yOPCFQ6H2z6ixUirq1ytGw4tBt8VnykaAebto6PEsi/T6jY=" diff --git a/.github/workflows/wrangler-deploy.yml b/.github/workflows/wrangler-deploy.yml new file mode 100644 index 0000000..9ae9f6f --- /dev/null +++ b/.github/workflows/wrangler-deploy.yml @@ -0,0 +1,72 @@ +name: Cloudflare Workers Deployments + +on: + push: + branches: [main] + +jobs: + paths-filter: + runs-on: ubuntu-latest + outputs: + golinks-next: ${{ steps.filter.outputs.golinks-next }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + golinks-next: + - 'apps/golinks-v2/**' + golinks-next: + name: Deploy golinks-next to staging + environment: + name: golinks-next/staging + url: ${{ steps.deploy.outputs.deployment-url }} + runs-on: ubuntu-latest + needs: [paths-filter] + if: needs.paths-filter.outputs.golinks-next == 'true' + steps: + - uses: actions/checkout@v4 + - uses: andreijiroh-dev/dotenvx-action@main + id: dotenvx + with: + key: ${{ secrets.DOTENV_PRIVATE_KEY_CI }} + path: .env.ci + - uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Install dependencies + run: yarn install + - name: Deploy to Workers in staging + id: deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ steps.dotenvx.outputs.WRANGLER_DEPLOY_TOKEN }} + comand: deploy --env staging + workingDirectory: apps/golinks-v2 + golinks-next-prod: + environment: + name: golinks-next/production + url: ${{ steps.deploy.outputs.deployment-url }} + runs-on: ubuntu-latest + needs: [paths-filter] + if: needs.paths-filter.outputs.golinks-next == 'true' + steps: + - uses: actions/checkout@v4 + - uses: andreijiroh-dev/dotenvx-action@main + id: dotenvx + with: + key: ${{ secrets.DOTENV_PRIVATE_KEY_CI }} + path: .env.ci + - uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Install dependencies + run: yarn install + - name: Deploy to Workers in staging + id: deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ steps.dotenvx.outputs.WRANGLER_DEPLOY_TOKEN }} + comand: deploy --env production + workingDirectory: apps/golinks-v2 diff --git a/.gitignore b/.gitignore index 897d644..ddf3485 100644 --- a/.gitignore +++ b/.gitignore @@ -73,11 +73,7 @@ web_modules/ .yarn-integrity # dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local +.env.keys # parcel-bundler cache (https://parceljs.org/) .cache diff --git a/apps/golinks-v2/.gitignore b/apps/golinks-v2/.gitignore deleted file mode 100644 index de87a7b..0000000 --- a/apps/golinks-v2/.gitignore +++ /dev/null @@ -1,173 +0,0 @@ -# Logs - -logs -_.log -npm-debug.log_ -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) - -report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json - -# Runtime data - -pids -_.pid -_.seed -\*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover - -lib-cov - -# Coverage directory used by tools like istanbul - -coverage -\*.lcov - -# nyc test coverage - -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) - -.grunt - -# Bower dependency directory (https://bower.io/) - -bower_components - -# node-waf configuration - -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) - -build/Release - -# Dependency directories - -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) - -web_modules/ - -# TypeScript cache - -\*.tsbuildinfo - -# Optional npm cache directory - -.npm - -# Optional eslint cache - -.eslintcache - -# Optional stylelint cache - -.stylelintcache - -# Microbundle cache - -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history - -.node_repl_history - -# Output of 'npm pack' - -\*.tgz - -# Yarn Integrity file - -.yarn-integrity - -# dotenv environment variable files - -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) - -.cache -.parcel-cache - -# Next.js build output - -.next -out - -# Nuxt.js build / generate output - -.nuxt -dist - -# Gatsby files - -.cache/ - -# Comment in the public line in if your project uses Gatsby and not Next.js - -# https://nextjs.org/blog/next-9-1#public-directory-support - -# public - -# vuepress build output - -.vuepress/dist - -# vuepress v2.x temp and cache directory - -.temp -.cache - -# Docusaurus cache and generated files - -.docusaurus - -# Serverless directories - -.serverless/ - -# FuseBox cache - -.fusebox/ - -# DynamoDB Local files - -.dynamodb/ - -# TernJS port file - -.tern-port - -# Stores VSCode versions used for testing VSCode extensions - -.vscode-test - -# yarn v2 - -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.\* - -# wrangler project - -.dev.vars - -.wrangler