From 52069209bf6ccd0785ce0d1a7fdebfc6f91ad179 Mon Sep 17 00:00:00 2001 From: sophia Date: Tue, 3 Dec 2024 14:48:04 -0800 Subject: [PATCH] Add release workflow --- .github/workflows/release.yml | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a9d9972..cff529be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -145,3 +145,65 @@ jobs: npm publish --verbose --access public ${{ env.PACKAGE_FILE }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + build_and_push_docker_image: + name: "Build Docker Images 🛠" + runs-on: ubuntu-latest + needs: release-to-npmjs: + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - name: "Checkout Repository 🛎" + uses: actions/checkout@v4 + + - name: "Retrieve secret from Vault 🗝" + uses: hashicorp/vault-action@v2 + with: + method: jwt + url: "https://quansight-vault-public-vault-b2379fa7.d415e30e.z1.hashicorp.cloud:8200" + namespace: "admin/quansight" + role: "repository-conda-incubator-conda-store-role" + secrets: | + kv/data/repository/conda-incubator/conda-store/shared_secrets DOCKER_QUANSIGHT_USERNAME | DOCKER_USERNAME; + kv/data/repository/conda-incubator/conda-store/shared_secrets DOCKER_QUANSIGHT_PASSWORD | DOCKER_PASSWORD; + kv/data/repository/conda-incubator/conda-store/shared_secrets QUAY_QUANSIGHT_USERNAME | QUAY_USERNAME; + kv/data/repository/conda-incubator/conda-store/shared_secrets QUAY_QUANSIGHT_PASSWORD | QUAY_PASSWORD; + + - name: "Set up Docker Buildx 🏗" + uses: docker/setup-buildx-action@v3 + + - name: "Login to Docker Hub 🐳" + uses: docker/login-action@v3 + with: + username: ${{ env.DOCKER_USERNAME }} + password: ${{ env.DOCKER_PASSWORD }} + + - name: "Login to quay.io 🐳" + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ env.QUAY_USERNAME }} + password: ${{ env.QUAY_PASSWORD }} + + - name: "Add Docker metadata 📝" + id: meta + uses: docker/metadata-action@v5 + with: + images: | + quansight/conda-store-ui + tags: | + type=ref,event=tag + type=ref,event=branch + type=sha + + - name: "Publish Docker image 🚀" + uses: docker/build-push-action@v5 + with: + context: . + target: "prod" + tags: | + ${{ steps.meta.outputs.tags }} + push: true + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max