-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #584 from microbiomedata/main
`berkeley`: Merge `main` into `berkeley` (to trigger GHA workflow)
- Loading branch information
Showing
1 changed file
with
101 additions
and
0 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
.github/workflows/build-and-release-to-spin-berkeley.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Note: This GitHub Actions workflow was initialized by copy/pasting the contents of `build-and-release-to-spin.yml`. | ||
# Changes made here since then include: | ||
# - Changed the triggering branch to `berkeley` (was `main`) | ||
# - Excluded Git tag creation from triggering criteria | ||
# - Hard-coded the Spin namespace as `nmdc-berkeley` for deployment | ||
# - Disabled pushing to Docker Hub (only push to GHCR) | ||
# - Changed tagging rules to, effectively, "always tag as :berkeley" | ||
|
||
name: Build Docker images and release to Spin (nmdc-berkeley) | ||
|
||
on: | ||
push: | ||
branches: | ||
- berkeley # the `berkeley` branch, not the `main` branch | ||
paths: | ||
- '.github/workflows/build-and-release-to-spin-berkeley.yml' | ||
- 'Makefile' | ||
- '**.Dockerfile' | ||
- '**.py' | ||
- 'requirements/main.txt' | ||
|
||
env: | ||
# We don't want to do certain steps if this is running in a fork | ||
IS_ORIGINAL_REPO: ${{ github.repository == 'microbiomedata/nmdc-runtime' }} | ||
|
||
# Used when sending redeploy action requests to Rancher | ||
RANCHER_NAMESPACE: 'nmdc-berkeley' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
image: [ fastapi, dagster ] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
# history for all branches and tags is needed for setuptools-scm (part of build and push step) | ||
fetch-depth: 0 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/microbiomedata/nmdc-runtime-${{ matrix.image }} | ||
flavor: | | ||
latest=false | ||
tags: | | ||
type=raw,value=berkeley | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
# Reference: https://docs.docker.com/build/ci/github-actions/push-multi-registries/ | ||
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ env.IS_ORIGINAL_REPO }} | ||
file: nmdc_runtime/${{ matrix.image }}.Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
release: | ||
needs: build | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
deployment: [ runtime-api, dagster-dagit, dagster-daemon ] | ||
|
||
steps: | ||
- name: Redeploy ${{ env.RANCHER_NAMESPACE }}:${{ matrix.deployment }} | ||
if: ${{ env.IS_ORIGINAL_REPO }} | ||
uses: fjogeleit/http-request-action@v1 | ||
with: | ||
url: ${{ secrets.RANCHER_URL }}/v3/project/${{ secrets.RANCHER_CONTEXT }}/workloads/deployment:${{ env.RANCHER_NAMESPACE }}:${{ matrix.deployment }}?action=redeploy | ||
method: POST | ||
bearerToken: ${{ secrets.RANCHER_TOKEN }} |