Parent directory

installer.yml

2011 bytes
 1name: Test and Deploy installer
 2on:
 3  workflow_dispatch: {}
 4  push:
 5    paths:
 6      - 'tools/install.sh'
 7      - '.github/workflows/installer/**'
 8      - '.github/workflows/installer.yml'
 9
10concurrency:
11  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12  cancel-in-progress: false
13
14permissions:
15  contents: read # to checkout
16
17jobs:
18  test:
19    name: Test installer
20    if: github.repository == 'ohmyzsh/ohmyzsh'
21    runs-on: ${{ matrix.os }}
22    strategy:
23      matrix:
24        os:
25          - ubuntu-latest
26          - macos-latest
27    steps:
28      - name: Harden the runner (Audit all outbound calls)
29        uses: step-security/harden-runner@b09bb98e06d4d774595224525879c09bc6e98c40 # v2.20.1
30        with:
31          egress-policy: audit
32
33      - name: Set up git repository
34        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
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: Harden the runner (Audit all outbound calls)
50        uses: step-security/harden-runner@b09bb98e06d4d774595224525879c09bc6e98c40 # v2.20.1
51        with:
52          egress-policy: audit
53
54      - name: Checkout
55        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
56      - name: Install Vercel CLI
57        run: npm install -g vercel
58      - name: Setup project and deploy
59        env:
60          VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
61          VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
62          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
63        run: |
64          cp tools/install.sh .github/workflows/installer/install.sh
65          cd .github/workflows/installer
66          vc deploy --prod -t "$VERCEL_TOKEN"