From 735fa669bf6bb96ebe53a9f9841615be6b1b7ded Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Thu, 27 Apr 2023 21:21:13 +0530 Subject: [PATCH] ci: automated github releases (#39) Closes #16 --- .github/workflows/release.yml | 90 +++++++++++++++++++++++++++++++++++ package.json | 3 ++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..842b1f3e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,90 @@ +name: Release + +on: + push: + branches: + - main + - beta + +jobs: + setup: + name: Set environment variables + runs-on: ubuntu-latest + timeout-minutes: 10 + outputs: + DEPLOY_ENVIRONMENT: ${{ steps.env.outputs.DEPLOY_ENVIRONMENT }} + DEPLOY_SUBDOMAIN: ${{ steps.env.outputs.DEPLOY_SUBDOMAIN }} + steps: + - name: "☁️ compute environment variables" + id: env + run: | + echo "::set-output name=DEPLOY_ENVIRONMENT::$([[ ${{ github.ref_name }} == 'main' ]] && echo 'production' || echo ${{ github.ref_name }})" + echo "::set-output name=DEPLOY_SUBDOMAIN::$([[ ${{ github.ref_name }} == 'main' ]] && echo '' || echo '${{ github.ref_name }}.')" + build: + name: Build application + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: "☁️ checkout repository" + uses: actions/checkout@v2 + + - name: "🔧 setup node" + uses: actions/setup-node@v2.1.5 + with: + node-version: 16 + + - name: "🔧 install npm@latest" + run: npm i -g npm@latest + + - name: "📦 install dependencies" + uses: bahmutov/npm-install@v1 + + - name: "🚀 static app" + run: npm run build + + - name: "📂 production artifacts" + uses: actions/upload-artifact@v2 + with: + name: build + path: dist + + release: + environment: + name: ${{ needs.setup.outputs.DEPLOY_ENVIRONMENT }} + url: https://${{ needs.setup.outputs.DEPLOY_SUBDOMAIN }}insights.opensauced.pizza + name: Semantic release + needs: + - setup + - build + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: "☁️ checkout repository" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: "📂 download build artifacts" + uses: actions/download-artifact@v2 + with: + name: build + path: build + + - name: "🚀 release" + id: semantic-release + uses: open-sauced/release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + cleanup: + name: Cleanup actions + needs: + - release + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: "♻️ remove build artifacts" + uses: geekyeggo/delete-artifact@v1 + with: + name: | + build \ No newline at end of file diff --git a/package.json b/package.json index 30582ab4..88df2b02 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,9 @@ "name": "opensauced-browser-extension", "private": true, "version": "0.0.0", + "files": [ + "dist/**/*" + ], "scripts": { "dev": "vite", "build": "tsc && vite build",