Skip to content

Commit

Permalink
github: Set common env var in the root of the file
Browse files Browse the repository at this point in the history
Some of the env vars are being used in multiple stages,
so instead of having to hard-code some small differences
in multiple places, bring it all back to a root level
where it's easier to see what changes for what environment.
  • Loading branch information
derrix060 committed Jun 26, 2024
1 parent 80806f0 commit 29f33bd
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Docker Build, Publish and Deploy

env:
DOCKER_REGISTRY: nethermind.jfrog.io

REPO_DEV: angkor-docker-local-dev
REPO_STAGING: angkor-docker-local-staging
REPO_PROD: angkor-docker-local-prod


on:
push:
branches: [main]
Expand All @@ -23,27 +31,22 @@ jobs:
- name: Define image tag
run: |
echo "DOCKER_IMAGE_TAG=$(git describe --tags)" >> $GITHUB_ENV
echo "DOCKER_REGISTRY"=nethermind.jfrog.io >> $GITHUB_ENV
echo "REPO_DEV=angkor-docker-local-dev" >> $GITHUB_ENV
echo "REPO_STAGING=angkor-docker-local-staging" >> $GITHUB_ENV
echo "REPO_PROD=angkor-docker-local-prod" >> $GITHUB_ENV
echo "DOCKER_REPO_DEV=${DOCKER_REGISTRY}/${REPO_DEV}/juno" >> $GITHUB_ENV
echo "DOCKER_REPO_STAGING=${DOCKER_REGISTRY}/${REPO_STAGING}/juno" >> $GITHUB_ENV
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to registry
run: |
docker login ${{ env.DOCKER_REGISTRY }} -u [email protected] -p ${{ secrets.ARTIFACTORY_ANGKOR_CONTRIBUTOR }}
docker login ${{ env.DOCKER_REGISTRY }} -u ${{ vars.ARTIFACTORY_ANGKOR_USER }} -p ${{ secrets.ARTIFACTORY_ANGKOR_CONTRIBUTOR }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
platforms: "linux/amd64"
push: true
tags: ${{ env.DOCKER_REPO_DEV }}:${{ env.DOCKER_IMAGE_TAG }}
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.REPO_DEV }}/juno:${{ env.DOCKER_IMAGE_TAG }}


validate_dev:
permissions:
Expand Down Expand Up @@ -120,6 +123,31 @@ jobs:
run: |
jf rt dpr juno/${{ env.DOCKER_IMAGE_TAG }} ${{ env.REPO_STAGING }} ${{ env.REPO_PROD }}
- name: Authenticate App
id: gh-app
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Trigger juno prod deployment workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: dispatch_render_juno.yml
repo: NethermindEth/argo
ref: "main"
token: "${{ steps.gh-app.outputs.token }}"
inputs: '{
"event_type": "${{ env.EVENT_NAME_PROD }}",
"client_payload": {
"name": "${{ env.EVENT_NAME_PROD }}",
"mainnet_config": "${{ env.MAINNET_PROD }}",
"sepolia_config": "${{ env.SEPOLIA_PROD }}",
"sepolia_integration_config": "${{ env.SEPOLIA_INTEGRATION_PROD }}",
"tag": "${{ env.DOCKER_IMAGE_TAG }}"
}
}'

prod-starknet-rs-tests:
needs: [promote_to_production]
uses: ./.github/workflows/starknet-rs-tests.yml
Expand Down

0 comments on commit 29f33bd

Please sign in to comment.