diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 0d5e8776..3d6c3ce1 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -7,13 +7,17 @@ on: push: branches: ['main'] +env: + AWS_REGION: ${{ vars.AWS_DEFAULT_REGION }} + AWS_ACCOUNT_ID: ${{ vars.AWS_CELLS_ACCOUNT_ID }} + permissions: contents: write pages: write id-token: write jobs: - build: + deploy-staging: runs-on: ubuntu-latest steps: - name: Checkout @@ -34,3 +38,32 @@ jobs: folder: ./dist clean-exclude: pr-preview/ branch: gh-pages + + deploy-prod: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Add SHORT_SHA env property with commit short sha + run: echo "SHORT_SHA=`echo ${{ github.sha }} | cut -c1-8`" >> $GITHUB_ENV + + - name: Configure AWS credentials with OIDC + uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 + with: + role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/github_cellpack + role-session-name: github_cellpack-${{ env.SHORT_SHA }} + aws-region: ${{ env.AWS_REGION }} + + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + + - name: Install + run: bun install + + - name: Build with Vite + run: bun run build + + - name: Copy files to production bucket + run: aws s3 sync ./dist/ s3://cellpack-datasets/ --delete diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 71c00f1c..9bad934d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,6 +29,22 @@ Typical steps to contribute: 4. Submit a pull request to merge your fork's branch into this repository, via GitHub. +## Deployment + +#### Staging deployment +Automatically builds from `main` +- [Staging site](https://allencell.github.io/cellpack-client/) + +#### Production deployment +Make sure the main branch is checked out and all desired changes are merged. Then: +1. Make a new version: `bun pm version [patch/minor/major]` -- this will give you the new tag, e.g., `1.3.2` +2. Push the new package.json version: `git push origin main` +3. Push the new tag: `git push origin [NEW_TAG]` -- e.g. `git push origin v1.3.2` +4. Write up [release notes](https://github.com/AllenCell/cellpack-client/releases). + - Select the tag + - Click "generate release notes" + - Use this template to summarize changes (delete any categories that aren't relevant) + ## Questions or Thoughts? Talk to us on [one of our community forums][community].