Aptos LC - Check for new tags and create issue #51
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: Aptos LC - Check for new tags and create issue | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs every day at midnight | |
jobs: | |
check-tags: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Fetch latest tag | |
id: latest-tag | |
run: | | |
LATEST_TAG=$(curl --silent "https://api.github.com/repos/aptos-labs/aptos-core/releases" | jq -r '.[] | select(.name | ascii_downcase | contains("mainnet")) | .tag_name' | grep '^aptos-node-v' | sort -V | tail -n 1) | |
CURRENT_TAG=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases" | jq -r '.[] | .tag_name' | grep '^aptos-node-v' | sort -V | tail -n 1) | |
LATEST_VERSION=$(echo $LATEST_TAG | awk -F'-' '{ print $3 }') | |
CURRENT_VERSION=$(echo $CURRENT_TAG | awk -F'-' '{ print $3 }') | |
# Check if there are any tags | |
if [[ $(echo -e "$CURRENT_VERSION\n$LATEST_VERSION" | sort -V | tail -n 1) == $CURRENT_TAG ]]; then | |
echo "The current tag is up to date." | |
exit 0 | |
fi | |
# If the current tag is not up to date, proceed to open an issue | |
echo "Current tag $CURRENT_TAG is out of date with upstream tag $LATEST_TAG, opening an issue" | |
echo "tag=${LATEST_TAG}" | tee -a $GITHUB_OUTPUT | |
- name: Create issue for release | |
uses: JasonEtco/create-an-issue@v2 | |
with: | |
filename: .github/ISSUE_TEMPLATE/tag_release.md | |
update_existing: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | |
RELEASE_TAG: ${{ steps.latest-tag.outputs.tag }} | |
UPSTREAM_URL: https://github.com/aptos-labs/aptos-core/releases/tag/${{ steps.latest-tag.outputs.tag }} | |
RELEASE_PR_WORKFLOW: ${{ github.server_url }}/${{ github.repository }}/actions/workflows/aptos-light-client-patch-release-pr.yml | |
RELEASE_MERGE_WORKFLOW: ${{ github.server_url }}/${{ github.repository }}/actions/workflows/aptos-light-client-patch-release-publish.yml | |
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |