From 036c908102694d8d7ddfa196ebcf0043bcdf1b66 Mon Sep 17 00:00:00 2001 From: Aryan Goyal <137564277+ary82@users.noreply.github.com> Date: Wed, 2 Oct 2024 20:54:19 +0530 Subject: [PATCH] ci(chrome_extension): add release workflow Signed-off-by: Aryan Goyal <137564277+ary82@users.noreply.github.com> --- .github/workflows/backend.yml | 8 ++-- .github/workflows/release.yml | 40 +++++++++++++++++++ chromium/socratic-code/.env.example | 1 - chromium/socratic-code/src/lib/index.ts | 2 +- .../socratic-code/src/routes/+page.svelte | 2 +- chromium/socratic-code/static/manifest.json | 2 +- 6 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 chromium/socratic-code/.env.example diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 2879846..40c98d4 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -7,9 +7,9 @@ name: Docker on: push: - branches: [ "main" ] + branches: ["main"] # Publish semver tags as releases. - tags: [ 'v*.*.*' ] + tags: ["v*.*.*"] env: # Use docker.io for Docker Hub if empty @@ -17,10 +17,8 @@ env: # github.repository as / IMAGE_NAME: ${{ github.repository }}/backend - jobs: build: - runs-on: ubuntu-latest permissions: contents: read @@ -38,7 +36,7 @@ jobs: - name: Install cosign uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0 with: - cosign-release: 'v2.2.4' + cosign-release: "v2.2.4" # Set up BuildKit Docker container builder to be able to build # multi-platform images and export cache diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..982c486 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: build and release extension +on: + push: + +jobs: + build: + runs-on: ubuntu-22.04 + strategy: + matrix: + node-version: [20] + steps: + - uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + cache-dependency-path: "chromium/socratic-code/pnpm-lock.yaml" + - name: Install dependencies + working-directory: ./chromium/socratic-code + run: pnpm install + - name: Build + working-directory: ./chromium/socratic-code + run: pnpm build + - name: Zip folder + working-directory: ./chromium/socratic-code + run: zip -r socratic-code.zip build + - name: Release + uses: softprops/action-gh-release@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag_name: "v1.0.0" + prerelease: false + draft: false + generate_release_notes: false + files: ./chromium/socratic-code/socratic-code.zip diff --git a/chromium/socratic-code/.env.example b/chromium/socratic-code/.env.example deleted file mode 100644 index 8d635c8..0000000 --- a/chromium/socratic-code/.env.example +++ /dev/null @@ -1 +0,0 @@ -PUBLIC_BACKEND_URL=localhost:8000 diff --git a/chromium/socratic-code/src/lib/index.ts b/chromium/socratic-code/src/lib/index.ts index 856f2b6..3c269e4 100644 --- a/chromium/socratic-code/src/lib/index.ts +++ b/chromium/socratic-code/src/lib/index.ts @@ -1 +1 @@ -// place files you want to import through the `$lib` alias in this folder. +export const PUBLIC_BACKEND_URL = 'https://socratic-leetcode-875479114962.asia-south1.run.app'; diff --git a/chromium/socratic-code/src/routes/+page.svelte b/chromium/socratic-code/src/routes/+page.svelte index 3368a15..1f7d90a 100644 --- a/chromium/socratic-code/src/routes/+page.svelte +++ b/chromium/socratic-code/src/routes/+page.svelte @@ -1,6 +1,6 @@