Merge pull request #197 from UW-Macrostrat/gbdb-example #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Continuous integration and deployment | |
| # On the main branch, successful commits will trigger a deployment to NPM | |
| # and building the storybook. | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "deployment" | |
| cancel-in-progress: false | |
| on: | |
| # When pushing, we also want to deploy packages to NPM | |
| push: | |
| branches: [main] | |
| jobs: | |
| prepare-and-publish-packages: | |
| name: Prepare and publish packages | |
| runs-on: ubuntu-latest | |
| env: | |
| # Ensure that Chalk uses colors in the output | |
| FORCE_COLOR: 2 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: | | |
| yarn install --frozen-lockfile | |
| - name: Build all packages | |
| run: | | |
| yarn run build | |
| - name: Set up git environment | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Publish and tag releases | |
| run: | | |
| yarn run publish | |
| env: | |
| YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
| - name: Push tags to repository | |
| run: | | |
| git push --tags | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-storybook: | |
| name: Build and deploy storybook | |
| runs-on: ubuntu-latest | |
| environment: development | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: | | |
| yarn install --frozen-lockfile | |
| - name: Build storybook | |
| run: | | |
| yarn run build:storybook | |
| env: | |
| VITE_MAPBOX_API_TOKEN: ${{ secrets.VITE_MAPBOX_API_TOKEN }} | |
| - name: Install rclone | |
| run: | | |
| curl https://rclone.org/install.sh | sudo bash | |
| - name: Upload storybook to S3 | |
| env: | |
| S3_BUCKET: ${{ vars.S3_BUCKET }} | |
| S3_PATH: ${{ vars.S3_PATH }} | |
| S3_ENDPOINT: ${{ vars.S3_ENDPOINT }} | |
| S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
| S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} | |
| VITE_MAPBOX_API_TOKEN: ${{ secrets.VITE_MAPBOX_API_TOKEN }} | |
| run: | | |
| echo "Uploading to S3 bucket: $S3_BUCKET" | |
| rclone sync ./storybook-static \ | |
| :s3:"$S3_BUCKET/$S3_PATH" \ | |
| --s3-provider=Ceph \ | |
| --s3-endpoint="$S3_ENDPOINT" \ | |
| --s3-access-key-id="$S3_ACCESS_KEY" \ | |
| --s3-secret-access-key="$S3_SECRET_KEY" |