fix tests #248
This file contains 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: CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
workflow_dispatch: | |
jobs: | |
# The first thing we want to do is build the entire monorepo, while still | |
# leveraging build caches and pnpm caches. If something has been changed, | |
# it will be rebuild, retested, and then re-cached. The next time any job | |
# needs the build output of a project, we restore the cache and then just | |
# build like normal which keeps the dependent jobs very fast. | |
rush-build: | |
name: "Rush build and test" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/rush-build | |
# Uses rush publish to publish all the packages to the npm registry. | |
rush-publish: | |
needs: rush-build | |
name: "Rush publish" | |
environment: Publish | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- run: | | |
git config --global user.name "Leo Conforti" | |
git config --global user.email "leo@leoconforti.us" | |
- uses: ./.github/actions/rush-build | |
- name: Verify Change Logs | |
run: node common/scripts/install-run-rush.js change --verify | |
- name: Rush publish | |
run: node common/scripts/install-run-rush.js publish --publish --apply --set-access-level public --target-branch main --add-commit-details --npm-auth-token ${{ secrets.NPM_AUTH_TOKEN }} | |
# In order to build the authproxy docker image, we first need to build it and | |
# its dependencies (remember this will be really fast because we are caching | |
# the build output and pnpm cache from the rush-build job). Then we use rush-deploy | |
# to create a tarball of the authproxy and only its dependencies before passing | |
# that to docker and letting docker build an image using it. | |
docker-authproxy: | |
needs: rush-build | |
name: "Docker authproxy build" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/rush-build | |
with: | |
BUILD_PARAMETERS: "--to @tinyburg/authproxy" | |
- uses: ./.github/actions/docker-build | |
with: | |
PROJECT: "authproxy" | |
DOCKERFILE: "./apps/authproxy/Dockerfile" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# In order to build the auto-gold-bits docker image, we do the same exact steps | |
# as we did for the authproxy docker image but using the auto-gold-bits project. | |
docker-auto-gold-bits: | |
needs: rush-build | |
name: "Docker auto-gold-bits build" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/rush-build | |
with: | |
BUILD_PARAMETERS: "--to @tinyburg/auto-gold-bits" | |
- uses: ./.github/actions/docker-build | |
with: | |
PROJECT: "auto-gold-bits" | |
DOCKERFILE: "./apps/auto-gold-bits/Dockerfile" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# In order to build the archivist docker image, we do the same exact steps | |
# as we did for the authproxy docker image but using the archivist project. | |
docker-archivist: | |
needs: rush-build | |
name: "Docker archivist build" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/rush-build | |
with: | |
BUILD_PARAMETERS: "--to @tinyburg/archivist" | |
- uses: ./.github/actions/docker-build | |
with: | |
PROJECT: "archivist" | |
DOCKERFILE: "./apps/archivist/Dockerfile" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# In order to deploy the authproxy docker image, we ssh into the digitalocean | |
# droplet hosting dokku and then re deploy the dokku app which will pull the | |
# latest docker image and restart the app. | |
deploy-authproxy: | |
needs: docker-authproxy | |
if: ${{ github.ref == 'refs/heads/main' }} | |
name: "Deploy docker authproxy" | |
environment: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: echo "AUTHPROXY_SHA=$(docker buildx imagetools inspect --format "{{json .Manifest.Digest}}" ghcr.io/leonitousconforti/tinyburg/authproxy:latest | xargs)" >> $GITHUB_ENV | |
- uses: dokku/github-action@master | |
with: | |
ssh_private_key: ${{ secrets.AUTHPROXY_DOKKU_KEY }} | |
git_remote_url: "ssh://dokku@authproxy.tinyburg.app:22/authproxy" | |
deploy_docker_image: ghcr.io/leonitousconforti/tinyburg/authproxy@${{ env.AUTHPROXY_SHA }} | |
# In order to deploy the auto-gold-bits docker image, we do the exact same | |
# steps as we did for the authproxy docker image but using the auto-gold-bits. | |
deploy-auto-gold-bits: | |
needs: docker-auto-gold-bits | |
if: ${{ github.ref == 'refs/heads/main' }} | |
name: "Deploy docker auto-gold-bits" | |
environment: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: echo "AUTO_GOLD_BITS_SHA=$(docker buildx imagetools inspect --format "{{json .Manifest.Digest}}" ghcr.io/leonitousconforti/tinyburg/auto-gold-bits:latest | xargs)" >> $GITHUB_ENV | |
- uses: dokku/github-action@master | |
with: | |
ssh_private_key: ${{ secrets.PLAYGROUND_DOKKU_KEY }} | |
git_remote_url: "ssh://dokku@playground.tinyburg.app:22/auto-gold-bits" | |
deploy_docker_image: ghcr.io/leonitousconforti/tinyburg/auto-gold-bits@${{ env.AUTO_GOLD_BITS_SHA }} | |
# In order to deploy the archivist docker image, we do the exact same | |
# steps as we did for the authproxy docker image but using the archivist. | |
deploy-archivist: | |
needs: docker-archivist | |
if: ${{ github.ref == 'refs/heads/main' }} | |
name: "Deploy docker archivist" | |
environment: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: echo "ARCHIVIST_SHA=$(docker buildx imagetools inspect --format "{{json .Manifest.Digest}}" ghcr.io/leonitousconforti/tinyburg/archivist:latest | xargs)" >> $GITHUB_ENV | |
- uses: dokku/github-action@master | |
with: | |
ssh_private_key: ${{ secrets.PLAYGROUND_DOKKU_KEY }} | |
git_remote_url: "ssh://dokku@playground.tinyburg.app:22/archivist" | |
deploy_docker_image: ghcr.io/leonitousconforti/tinyburg/archivist@${{ env.ARCHIVIST_SHA }} |