6101106916147b1716ff2d5de4a53260e7607bae

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(install): deploy installer to install.ohmyz.sh (#11722)

Co-authored-by: Marc Cornellà <hello@mcornella.com>

Diff

  1diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..ac88d10b08da7778c8528abfc3e08ca2e286519b
  4--- /dev/null
  5+++ b/.github/workflows/installer.yml
  6@@ -0,0 +1,55 @@
  7+name: Test and Deploy installer
  8+on:
  9+  workflow_dispatch: {}
 10+  push:
 11+    paths:
 12+      - tools/install.sh
 13+      - .github/workflows/installer
 14+      - .github/workflows/installer.yml
 15+
 16+concurrency:
 17+  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
 18+  cancel-in-progress: false
 19+
 20+permissions:
 21+  contents: read # to checkout
 22+
 23+jobs:
 24+  test:
 25+    name: Test installer
 26+    runs-on: ${{ matrix.os }}
 27+    strategy:
 28+      matrix:
 29+        os:
 30+          - ubuntu-latest
 31+          - macos-latest
 32+    steps:
 33+      - name: Set up git repository
 34+        uses: actions/checkout@v3
 35+      - name: Install zsh
 36+        if: runner.os == 'Linux'
 37+        run: sudo apt-get update; sudo apt-get install zsh
 38+      - name: Test installer
 39+        run: sh ./tools/install.sh
 40+
 41+  deploy:
 42+    name: Deploy installer in install.ohmyz.sh
 43+    if: github.ref == 'refs/heads/master'
 44+    runs-on: ubuntu-latest
 45+    environment: vercel
 46+    needs:
 47+      - test
 48+    steps:
 49+      - name: Checkout
 50+        uses: actions/checkout@v3
 51+      - name: Install Vercel CLI
 52+        run: npm install -g vercel
 53+      - name: Setup project and deploy
 54+        env:
 55+          VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
 56+          VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
 57+        run: |
 58+          cp tools/install.sh .github/workflows/installer/install.sh
 59+          cd .github/workflows/installer
 60+          vc link --yes -t ${{ secrets.VERCEL_TOKEN }}
 61+          vc deploy --prod -t ${{ secrets.VERCEL_TOKEN }}
 62diff --git a/.github/workflows/installer/.gitignore b/.github/workflows/installer/.gitignore
 63new file mode 100644
 64index 0000000000000000000000000000000000000000..f66fce31004c29b891dc686c172f2a09efb53b75
 65--- /dev/null
 66+++ b/.github/workflows/installer/.gitignore
 67@@ -0,0 +1 @@
 68+install.sh
 69diff --git a/.github/workflows/installer/.vercelignore b/.github/workflows/installer/.vercelignore
 70new file mode 100644
 71index 0000000000000000000000000000000000000000..41b23336484d14ed2cd684932148712c9c92e444
 72--- /dev/null
 73+++ b/.github/workflows/installer/.vercelignore
 74@@ -0,0 +1,2 @@
 75+/*
 76+!/install.sh
 77diff --git a/.github/workflows/installer/vercel.json b/.github/workflows/installer/vercel.json
 78new file mode 100644
 79index 0000000000000000000000000000000000000000..8c5aec5e096c37e05914c0362b592c76bf2ca251
 80--- /dev/null
 81+++ b/.github/workflows/installer/vercel.json
 82@@ -0,0 +1,14 @@
 83+{
 84+  "headers": [
 85+    {
 86+      "source": "/((?!favicon.ico).*)",
 87+      "headers": [{ "key": "Content-Type", "value": "text/plain" }]
 88+    }
 89+  ],
 90+  "rewrites": [
 91+    {
 92+      "source": "/((?!favicon.ico|install.sh).*)",
 93+      "destination": "/install.sh"
 94+    }
 95+  ]
 96+}
 97diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
 98index 8ee2df3d8f92d0270d85062ea5bb4251633a9892..57403629c72d4aa7a190f69df2afdd765ed48409 100644
 99--- a/.github/workflows/main.yml
100+++ b/.github/workflows/main.yml
101@@ -31,8 +31,6 @@ jobs:
102       - name: Install zsh
103         if: runner.os == 'Linux'
104         run: sudo apt-get update; sudo apt-get install zsh
105-      - name: Test installer
106-        run: sh ./tools/install.sh
107       - name: Check syntax
108         run: |
109           for file in ./oh-my-zsh.sh \