Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create GHA to deploy vespa-search code #159

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build & Deploy

permissions:
contents: read
id-token: write

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: yarn install

- name: Build project
run: yarn build

- name: Store build artifact
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/master'
with:
name: build
path: dist/

deploy:
if: github.ref == 'refs/heads/main'

runs-on: ubuntu-latest

needs:
- build

environment:
name: Production
url: ${{ vars.PUBLIC_URL }}

steps:
- uses: actions/download-artifact@v4
with:
name: build
path: dist/

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: ${{ vars.IAM_ROLE }}

- name: Deploy
run: |
aws s3 sync dist/ "s3://${{ vars.S3_BUCKET }}/frontend/" --exclude "*.map" --no-progress
aws cloudfront create-invalidation --distribution-id "${{ vars.CF_DISTRIBUTION_ID }}" --paths "/*"