From c2ec2f10a2a6cf7dddbdeed2d6a4b799de49ce01 Mon Sep 17 00:00:00 2001 From: Byron Ruth Date: Tue, 28 Nov 2023 12:21:52 -0600 Subject: [PATCH] Revert GHA to combine preview/deploy (#173) Signed-off-by: Byron Ruth --- .github/workflows/deploy.yaml | 22 +++++++++--- .github/workflows/preview.yaml | 61 ---------------------------------- 2 files changed, 17 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/preview.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 98cccb9d..66b21db5 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,8 +1,5 @@ name: deploy -on: - push: - branches: - - main +on: [push] jobs: run: @@ -18,6 +15,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} - name: Setup Python uses: actions/setup-python@v4 @@ -49,6 +48,7 @@ jobs: - name: Auto-commit generated recordings uses: stefanzweifel/git-auto-commit-action@v5 + if: ${{ github.ref_name == 'main' }} with: commit_message: Auto-commit recording file_pattern: examples/**/output.txt examples/**/output.cast @@ -57,12 +57,24 @@ jobs: run: | nbe build + - name: Vercel preview deploy + uses: amondnet/vercel-action@v25 + if: ${{ github.ref_name != 'main' }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + vercel-token: ${{ secrets.VERCEL_TOKEN }} + vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} + vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} + scope: ${{ secrets.VERCEL_TEAM_SCOPE }} + working-directory: ./html + - name: Vercel production deploy uses: amondnet/vercel-action@v25 + if: ${{ github.ref_name == 'main' }} with: vercel-args: "--prod" - vercel-token: ${{ secrets.VERCEL_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} + vercel-token: ${{ secrets.VERCEL_TOKEN }} vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} scope: ${{ secrets.VERCEL_TEAM_SCOPE }} diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml deleted file mode 100644 index d614b05d..00000000 --- a/.github/workflows/preview.yaml +++ /dev/null @@ -1,61 +0,0 @@ -name: preview -on: pull_request - -jobs: - run: - name: Preview - runs-on: "ubuntu-latest" - - permissions: - contents: write - issues: write - pull-requests: write - statuses: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - - name: Install Asciinema - run: | - python3 -m pip install asciinema - - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: "1.21" - cache-dependency-path: cmd/nbe/go.sum - - - name: Test nbe - run: | - go test -v -race ./cmd/nbe - - - name: Build nbe - run: | - go install ./cmd/nbe - - - name: Generate recordings - shell: 'script -q -e -c "bash {0}"' - run: | - nbe generate recording --exit-on-error - - - name: Build HTML - run: | - nbe build - - - name: Vercel preview deploy - uses: amondnet/vercel-action@v25 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - vercel-token: ${{ secrets.VERCEL_TOKEN }} - vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} - vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} - scope: ${{ secrets.VERCEL_TEAM_SCOPE }} - working-directory: ./html