-
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.
Separate dev and production deployments in GitHub workflow (#382)
* Consolidate workflows for building docker images and deploying to Spin into one workflow * Remove docker-build.sh in favor of letting GitHub Actions handle Docker build and push * Update Release Process doc with info about initiating via GitHub Releases * Replace Rancher-Action with generic HTTP call * Replace release event with tag push event, which is required for semver metadata * Remove unnecessary pr event * Add more release instructions
- Loading branch information
1 parent
d3c0e0d
commit acbc9f9
Showing
7 changed files
with
92 additions
and
192 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
.idea | ||
docker-compose.yml | ||
.dockerignore | ||
docker-build.sh | ||
deployment | ||
.eggs | ||
.pytest_cache | ||
|
This file was deleted.
Oops, something went wrong.
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,81 @@ | ||
name: Build Docker images and release to Spin | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
paths: | ||
- '.github/workflows/build-and-release-to-spin.yml' | ||
- 'Makefile' | ||
- '**.Dockerfile' | ||
- '**.py' | ||
- 'requirements/main.txt' | ||
|
||
env: | ||
IS_PROD_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
image: [ fastapi, dagster ] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- 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: | | ||
microbiomedata/nmdc-runtime-${{ matrix.image }} | ||
flavor: | | ||
latest=false | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=raw,value=prod,enable=${{ env.IS_PROD_RELEASE }} | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
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 ] | ||
|
||
env: | ||
NAMESPACE: ${{ env.IS_PROD_RELEASE && 'nmdc' || 'nmdc-dev' }} | ||
|
||
steps: | ||
- name: Redeploy ${{ env.NAMESPACE }}:${{ matrix.deployment }} | ||
uses: fjogeleit/http-request-action@v1 | ||
with: | ||
url: ${{ secrets.RANCHER_URL }}/v3/project/${{ secrets.RANCHER_CONTEXT }}/workloads/deployment:${{ env.NAMESPACE }}:${{ matrix.deployment }}?action=redeploy | ||
method: POST | ||
bearerToken: ${{ secrets.RANCHER_TOKEN }} |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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