summaryrefslogtreecommitdiff
path: root/.github/workflows/installer.yml
blob: eef5bf3227eba84b112cff76434869bd97b5cb73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Test and Deploy installer
on:
  workflow_dispatch: {}
  push:
    paths:
      - 'tools/install.sh'
      - '.github/workflows/installer/**'
      - '.github/workflows/installer.yml'

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: false

permissions:
  contents: read # to checkout

jobs:
  test:
    name: Test installer
    if: github.repository == 'ohmyzsh/ohmyzsh'
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
    steps:
      - name: Harden the runner (Audit all outbound calls)
        uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
        with:
          egress-policy: audit

      - name: Set up git repository
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
      - name: Install zsh
        if: runner.os == 'Linux'
        run: sudo apt-get update; sudo apt-get install zsh
      - name: Test installer
        run: sh ./tools/install.sh

  deploy:
    name: Deploy installer in install.ohmyz.sh
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    environment: vercel
    needs:
      - test
    steps:
      - name: Harden the runner (Audit all outbound calls)
        uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
        with:
          egress-policy: audit

      - name: Checkout
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
      - name: Install Vercel CLI
        run: npm install -g vercel
      - name: Setup project and deploy
        env:
          VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
          VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
        run: |
          cp tools/install.sh .github/workflows/installer/install.sh
          cd .github/workflows/installer
          vc deploy --prod -t "$VERCEL_TOKEN"