UpdateStackRepo #1034
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: Update Stack Repo | |
on: | |
repository_dispatch: | |
types: | |
- UpdateStackRepo | |
jobs: | |
update_stack_repo: | |
name: Update Stack Repo | |
runs-on: ubuntu-latest | |
env: | |
SERVICE_NAME: ${{ github.event.client_payload.service.name }} | |
SERVICE_VERSION: ${{ github.event.client_payload.service.details.image.tag }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.client_payload.branch }} | |
- name: Create yq Query | |
id: create_yq_query | |
env: | |
SERVICE_UPDATE: ${{ toJson(github.event.client_payload.service.details) }} | |
run: | | |
echo "Updating stack repo entry for ${SERVICE_NAME}" | |
echo "Update is:" | |
echo ${SERVICE_UPDATE} | json_pp | |
echo "Current stack is:" | |
cat stack.yml | |
cat plugins.yml | |
SERVICE_QUERY="(.${{ github.event.client_payload.stackPath }}.$SERVICE_NAME)" | |
echo ::set-output name=query::"$SERVICE_QUERY = ${SERVICE_UPDATE//$'\n'/} | sortKeys(..)" | |
- name: Update Stack File | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq eval -i '${{ steps.create_yq_query.outputs.query }}' ${{ github.event.client_payload.stackFile }} | |
- name: Create Pull Request | |
uses: peter-evans/[email protected] | |
with: | |
token: ${{ secrets.ASTROLABE_GITHUB_TOKEN }} | |
commit-message: "chore(cd): update ${{ env.SERVICE_NAME}} version to ${{ env.SERVICE_VERSION}}" | |
branch: ${{ env.SERVICE_NAME}}_${{ env.SERVICE_VERSION}} | |
branch-suffix: timestamp | |
title: "chore(cd): update ${{ env.SERVICE_NAME}} version to ${{ env.SERVICE_VERSION}}" | |
labels: | | |
autoMerge | |
stackUpdate | |
body: | | |
Event | |
``` | |
${{ toJson(github.event.client_payload) }} | |
``` |