Skip to content

fix: ci

fix: ci #16

Workflow file for this run

name: Create Release
on:
push:
branches:
- main # Adjust the branch as needed
workflow_dispatch:
jobs:
check-tags:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Git
run: |
git config --global user.name "Zach"
git config --global user.email "[email protected]"
- name: Fetch local tags
run: |
git fetch --tags
- name: Fetch all tags from upstream in temporary directory
run: |
mkdir temp_upstream_repo
cd temp_upstream_repo
git init
git remote add upstream https://github.com/Lakr233/NotchDrop
git fetch upstream --tags
latest_upstream_tag=$(git ls-remote --tags upstream | grep -v "AAPL" | awk -F'/' '{print $3}' | grep -v '{}$' | sort -V | tail -n 1)
echo "Latest upstream tag: $latest_upstream_tag"
echo latest_upstream_tag=$latest_upstream_tag >> $GITHUB_ENV
cd ..
- name: Get latest local tag
run: |
latest_local_tag=$(git tag --list | grep -v "AAPL" | sort -V | tail -n 1)
echo "Latest local tag: $latest_local_tag"
echo latest_local_tag=$latest_local_tag >> $GITHUB_ENV
- name: Compare tags
id: check_tags
run: |
if [ "$latest_local_tag" != "$latest_upstream_tag" ]; then
echo new_release=true >> $GITHUB_OUTPUT
else
echo new_release=false >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release
if: steps.check_tags.outputs.new_release == 'true'
uses: ncipollo/[email protected]
with:
tag: ${{ env.latest_upstream_tag }}
name: ${{ env.latest_upstream_tag }}
body: 'Automated release for tag ${{ env.latest_upstream_tag }}'
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger Build Workflow
if: steps.check_tags.outputs.new_release == 'true'
run: |
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/Zach677/NotchDrop/dispatches \
-d '{"event_type":"release_created"}'