Skip to content

Commit

Permalink
feat: dispatch trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
apham0001 committed Oct 3, 2024
1 parent 3242425 commit d1a19d5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 119 deletions.
84 changes: 30 additions & 54 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,64 +32,40 @@ jobs:
body_path: changelog.md
token: ${{ secrets.RELEASE_SECRET }}

extract-tag:
trigger-dispatch:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.get_tag_name.outputs.tag_name }}
steps:
- name: Extract tag name
id: get_tag_name
run: echo "::set-output name=tag_name::${GITHUB_REF##*/}"
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV

create-pr-obol-infrastructure:
runs-on: ubuntu-latest
needs: extract-tag
uses: ./.github/workflows/update-version-pr.yml
with:
repository: ObolNetwork/obol-infrastructure.git
path: obol-infrastructure
file_changes_script: |
sed -i 's/default = "v[0-9.]*"/default = "'${{ needs.extract-tag.outputs.tag_name#v }}'"/g' performance-cluster/variables.tf
base_branch: main

create-pr-helm:
runs-on: ubuntu-latest
needs: extract-tag
uses: ./.github/workflows/update-version-pr.yml
with:
repository: ObolNetwork/helm-charts.git
path: helm-charts
file_changes_script: |
increment_version() {
echo "$1" | awk -F. '{printf "%d.%d.%d", $1, $2, $3+1}'
}
# Update charon-cluster Chart.yaml
CHART_CLUSTER_VERSION=$(grep '^version:' charts/charon-cluster/Chart.yaml | awk '{print $2}')
NEW_CHART_CLUSTER_VERSION=$(increment_version $CHART_CLUSTER_VERSION)
sed -i "s/^version: .*/version: ${NEW_CHART_CLUSTER_VERSION}/" charts/charon-cluster/Chart.yaml
sed -i "s/^appVersion: .*/appVersion: \"${{ needs.extract-tag.outputs.tag_name#v }}\"/" charts/charon-cluster/Chart.yaml
# Update charon-cluster values.yaml
sed -i "/tag:/s/v[0-9.]*$/v${{ needs.extract-tag.outputs.tag_name#v }}/" charts/charon-cluster/values.yaml
- name: Trigger dispatch for obol-docs
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.OBOL_PLATFORM_PAT }}
repository: ObolNetwork/obol-docs
event-type: update-version
client-payload: '{"tag": "${{ env.TAG_NAME }}"}'

# Update charon Chart.yaml
CHART_VERSION=$(grep '^version:' charts/charon/Chart.yaml | awk '{print $2}')
NEW_CHART_VERSION=$(increment_version $CHART_VERSION)
sed -i "s/^version: .*/version: ${NEW_CHART_VERSION}/" charts/charon/Chart.yaml
sed -i "s/^appVersion: .*/appVersion: \"${{ needs.extract-tag.outputs.tag_name#v }}\"/" charts/charon/Chart.yaml
- name: Trigger dispatch for obol-infrastructure
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.OBOL_PLATFORM_PAT }}
repository: ObolNetwork/obol-infrastructure
event-type: update-version
client-payload: '{"tag": "${{ env.TAG_NAME }}"}'

# Update charon values.yaml
sed -i "/tag:/s/v[0-9.]*$/v${{ needs.extract-tag.outputs.tag_name#v }}/" charts/charon/values.yaml
base_branch: main
- name: Trigger dispatch for helm-charts
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.OBOL_PLATFORM_PAT }}
repository: ObolNetwork/helm-charts
event-type: update-version
client-payload: '{"tag": "${{ env.TAG_NAME }}"}'

create-pr-obol-ansible:
runs-on: ubuntu-latest
needs: extract-tag
uses: ./.github/workflows/update-version-pr.yml
with:
repository: ObolNetwork/obol-ansible.git
path: obol-ansible
file_changes_script: |
sed -i "s/^node_image_version: 'v[0-9.]*'/node_image_version: 'v${{ needs.extract-tag.outputs.tag_name#v }}'/" group_vars/all.yml
base_branch: main
- name: Trigger dispatch for obol-ansible
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.OBOL_PLATFORM_PAT }}
repository: ObolNetwork/obol-ansible
event-type: update-version
client-payload: '{"tag": "${{ env.TAG_NAME }}"}'
65 changes: 0 additions & 65 deletions .github/workflows/update-version-pr.yml

This file was deleted.

0 comments on commit d1a19d5

Please sign in to comment.