write-values #20
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: Write values.yaml | |
on: | |
repository_dispatch: | |
types: [write-values] | |
jobs: | |
write_values_file: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
- name: Create Directory | |
run: mkdir -p ./pipelines/${{ github.event.client_payload.environment }}/${{ github.event.client_payload.name }} | |
- name: Write values.yaml file | |
run: | | |
cat <<EOF > ./pipelines/${{ github.event.client_payload.environment }}/${{ github.event.client_payload.name }}/values.yaml | |
club: ${{ github.event.client_payload.club }} | |
name: ${{ github.event.client_payload.name }} | |
organization: ${{ github.event.client_payload.organization }} | |
repository: ${{ github.event.client_payload.repository }} | |
branch: ${{ github.event.client_payload.branch }} | |
environment: ${{ github.event.client_payload.environment }} | |
containerPort: ${{ github.event.client_payload.containerPort }} | |
domain: ${{ github.event.client_payload.domain }} | |
language: ${{ github.event.client_payload.language }} | |
critical_service: ${{ github.event.client_payload.critical_service }} | |
EOF | |
- name: Commit The New Image Reference | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "release :: Add values.yaml for ${{ github.event.client_payload.name }}" | |
branch: main | |
repository: . | |
commit_user_name: XQUARE GitOps Bot | |
commit_user_email: [email protected] | |
commit_author: XQUARE GitOps Bot <[email protected]> | |
- name: Sync Container Domain to infra server | |
continue-on-error: true | |
shell: bash | |
run: | | |
url="https://xquare-infra-backend.xquare.app/v2/container/${{ github.event.client_payload.name }}/${{ github.event.client_payload.environment }}/sync-domain?domain=${{ github.event.client_payload.domain }}" | |
curl -X PUT $url | |
- name: Pull latest changes | |
run: git pull origin main | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v1 | |
with: | |
token: ${{ secrets.XQUARE_ACTION_GHP_TOKEN }} | |
repository: team-xquare/xquare-gitops-repo-v2 | |
event-type: generate_pipeline | |
client-payload: | | |
{ | |
"ref" : "main", | |
"pipeline_name" : "build-${{ github.event.client_payload.name }}-${{ github.event.client_payload.environment }}" | |
} |