Skip to content

Commit

Permalink
update env change
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Oct 30, 2024
1 parent 48049c1 commit 64957dd
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,20 @@ on:
push:

jobs:
configure-environment:
build-base-image:
environment: bio-check-prod
runs-on: ubuntu-latest
steps:
# Step 1: Checkout repository
- name: Checkout code
uses: actions/checkout@v2

# Step 2: Log in to GHCR
- name: Test Log in to GHCR
run: echo "${{ secrets.REPO_ADMIN_GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.REPO_ADMIN_GH_USERNAME }}" --password-stdin

# Step 3: Install Docker Compose
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # Check if Docker Compose is installed correctly
build-base-image:
needs: configure-environment
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get base image version
run: |
BASE_VERSION=$(cat ./assets/.BASE_VERSION)
Expand All @@ -41,7 +30,11 @@ jobs:
env:
BIOSIMULATIONS_GCLOUD_CONFIG: ${{ secrets.BIO_JSON_CONTENT }}

- name: Build base image
- name: Get new base tag
run: |
BASE_IMG=ghcr.io/biosimulators/bio-check-base
echo "BASE_IMG=$BASE_IMG" >> $GITHUB_ENV
- name: Test build base image
run: |
docker build --no-cache -f ./Dockerfile-base -t ghcr.io/biosimulators/bio-check-base:${{ env.BASE_VERSION }} .
docker images
docker build --no-cache -f ./Dockerfile-base -t ${{ env.BASE_IMG }}:${{ env.BASE_VERSION }} .
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy Service Images

on:
workflow_dispatch:

jobs:
deploy-base-image:
environment: bio-check-prod
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Log in to GHCR
run: echo "${{ secrets.REPO_ADMIN_GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.REPO_ADMIN_GH_USERNAME }}" --password-stdin

- name: Get base image version
run: |
BASE_VERSION=$(cat ./assets/.BASE_VERSION)
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV
echo "Base Version: $BASE_VERSION"
- name: Create gcloud config
run: |
echo "$BIOSIMULATIONS_GCLOUD_CONFIG" > ./assets/configs/.biosimulations.json
env:
BIOSIMULATIONS_GCLOUD_CONFIG: ${{ secrets.BIO_JSON_CONTENT }}

- name: Build base image
run: |
docker build --no-cache -f ./Dockerfile-base -t ${{ env.BASE_IMG }}:${{ env.BASE_VERSION }} .
- name: Deploy new base version to GHCR
run: |
docker push ${{ env.BASE_IMG }}:${{ env.BASE_VERSION }}
- name: Deploy new latest base version
run: |
docker tag ${{ env.BASE_IMG }}:${{ env.BASE_VERSION }} ${{ env.BASE_IMG }}:latest
docker push ${{ env.BASE_IMG }}:latest
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 64957dd

Please sign in to comment.