create: merkl-lite #60
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
name: Build image and trigger staging deployment | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
env: | |
IMAGE_URL: europe-west1-docker.pkg.dev/angle-artifacts/angle-docker-registry/merkl-app | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
token: '${{ secrets.ACCESS_TOKEN }}' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: 'google-github-actions/auth@v0' | |
with: | |
credentials_json: '${{ secrets.GCLOUD_SECRET_ARTIFACTS }}' | |
- name: Login to Docker | |
run: gcloud auth configure-docker europe-west1-docker.pkg.dev | |
- name: Build image | |
run: | | |
export SHORT_SHA=${GITHUB_SHA:0:7} | |
docker pull $IMAGE_URL:latest || true | |
docker build --cache-from $IMAGE_URL:latest --tag $IMAGE_URL:$SHORT_SHA --tag $IMAGE_URL:latest . | |
- name: Push image | |
run: | | |
export SHORT_SHA=${GITHUB_SHA:0:7} | |
docker push $IMAGE_URL:$SHORT_SHA | |
trigger-staging-deployment: | |
runs-on: ubuntu-latest | |
needs: build-image | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo snap install yq | |
- name: Clone deployments repo | |
uses: actions/checkout@v3 | |
with: | |
repository: AngleProtocol/deployments | |
token: ${{ secrets.ACCESS_TOKEN }} | |
path: deployments | |
- name: Modify config.staging.yaml and push to deployments | |
run: | | |
cd deployments | |
export SHORT_SHA=${GITHUB_SHA:0:7} | |
yq -i '.merkl-app.version = strenv(SHORT_SHA)' ./config.staging.yaml | |
git config --global user.email "[email protected]" | |
git config --global user.name "BaptistG" | |
git add ./config.staging.yaml | |
git commit -m "Update config.staging.yaml with merkl-app version $SHORT_SHA" | |
git push |