check if latest tag is a ycharts tag #7
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: 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 }} |