Skip to content

Commit

Permalink
patch and tag workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
skoobasteeve committed Aug 21, 2024
1 parent 5545aff commit 892c6a2
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/ycharts_patch_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
name: YCharts Patch and Tag
on:
workflow_dispatch:
push:
branches:
- master
- xmlsec-1_2_x

env:
GIT_EMAIL: [email protected]
GIT_NAME: ychartsdeployer
PATCH_COMMIT: bcb130ffe50086c5ebade24b9f4fcbfe91664417 # pragma: allowlist secret

jobs:
sync_with_upstream:
runs-on: namespace-profile-ubuntu-2004-4vcpu-8gbram
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure git
run: |
git config --global user.email ${{ env.GIT_EMAIL }}
git config --global user.name ${{ env.GIT_NAME }}
git fetch --tags --force origin
- name: Check for new release tag - master
id: tag-check-master
run: |
git checkout master
git fetch --tags --force origin
LATEST_TAG=$(git describe --tags --abbrev=0)
if [ $(git tag -l "$LATEST_TAG-ycharts") ] || [[ $LATEST_TAG == *"-ycharts" ]]; then
echo "tag_exists=true" >> $GITHUB_OUTPUT
else
echo "tag_exists=false" >> $GITHUB_OUTPUT
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
fi

- name: Apply ycharts patch and create tag
if: steps.tag-check-master.outputs.tag_exists == 'false'
run: |
git reset --hard ${{ steps.tag-check-master.outputs.latest_tag }}
git cherry-pick ${{ env.PATCH_COMMIT }}
git tag ${{ steps.tag-check-master.outputs.latest_tag }}-ycharts
- name: Check for new release tag - 1.2.x
id: tag-check-1_2_x
run: |
git checkout xmlsec-1_2_x
git fetch --tags --force origin
LATEST_TAG=$(git describe --tags --abbrev=0)
if [ $(git tag -l "$LATEST_TAG-ycharts") ] || [[ $LATEST_TAG == *"-ycharts" ]]; then
echo "tag_exists=true" >> $GITHUB_OUTPUT
else
echo "tag_exists=false" >> $GITHUB_OUTPUT
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo $LATEST TAG
fi

- name: Apply ycharts patch and create tag
if: steps.tag-check-1_2_x.outputs.tag_exists == 'false'
run: |
git reset --hard ${{ steps.tag-check-1_2_x.outputs.latest_tag }}
git cherry-pick ${{ env.PATCH_COMMIT }}
git tag ${{ steps.tag-check-1_2_x.outputs.latest_tag }}-ycharts
- name: Push YCharts patch and tag
run: |
git push origin master:master
git push origin xmlsec-1_2_x:xmlsec-1_2_x
git push origin --tags --force
# - name: Send PagerDuty alert on failure
# if: failure()
# uses: miparnisari/[email protected]
# with:
# pagerduty-integration-key: ${{ secrets.PAGERDUTY_YCHARTS_DEVOPS_LOW_PRIORITY_EVENTS_API_INTEGRATION_KEY }}

0 comments on commit 892c6a2

Please sign in to comment.