logtide-release #6
This file contains hidden or 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 App Version | |
| on: | |
| repository_dispatch: | |
| types: [logtide-release] | |
| permissions: | |
| contents: write | |
| actions: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Bump versions in Chart.yaml | |
| id: bump | |
| run: | | |
| APP_VERSION="${{ github.event.client_payload.version }}" | |
| CURRENT_APP=$(grep '^appVersion:' charts/logtide/Chart.yaml | awk '{print $2}' | tr -d '"') | |
| if [ "$CURRENT_APP" = "$APP_VERSION" ]; then | |
| echo "already at appVersion $APP_VERSION, skipping" | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| CURRENT=$(grep '^version:' charts/logtide/Chart.yaml | awk '{print $2}') | |
| MAJOR=$(echo $CURRENT | cut -d. -f1) | |
| MINOR=$(echo $CURRENT | cut -d. -f2) | |
| PATCH=$(echo $CURRENT | cut -d. -f3) | |
| NEW_CHART_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" | |
| sed -i "s/^version:.*/version: ${NEW_CHART_VERSION}/" charts/logtide/Chart.yaml | |
| sed -i "s/^appVersion:.*/appVersion: \"${APP_VERSION}\"/" charts/logtide/Chart.yaml | |
| echo "chart: ${CURRENT} → ${NEW_CHART_VERSION}" | |
| echo "appVersion: ${APP_VERSION}" | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push | |
| if: steps.bump.outputs.changed == 'true' | |
| run: | | |
| git add charts/logtide/Chart.yaml | |
| git commit -m "bump to logtide v${{ github.event.client_payload.version }}" | |
| git push origin main | |
| - name: Trigger release workflow | |
| if: steps.bump.outputs.changed == 'true' | |
| run: gh workflow run release.yaml --ref main | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |