Check GitHub Release #549
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: Check GitHub Release | |
on: | |
schedule: | |
# Daily at 8:20 UTC and 20:20 UTC | |
- cron: '20 8,20 * * *' | |
# Enables manually running this workflow from the Actions tab | |
workflow_dispatch: | |
jobs: | |
check: | |
name: Check GitHub Release | |
runs-on: ubuntu-latest | |
env: | |
BINARY_NAME: lefthook | |
BINARY_REPO: evilmartians/lefthook | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SEMANTIC_VERSIONING_REGEX: (v?[0-9]+\.[0-9]+\.[0-9]+) | |
outputs: | |
BINARY_NAME: ${{ env.BINARY_NAME }} | |
BINARY_REPO: ${{ env.BINARY_REPO }} | |
BINARY_VERSION: ${{ steps.two.outputs.BINARY_VERSION }} | |
PLUGIN_VERSION: ${{ steps.one.outputs.PLUGIN_VERSION }} | |
TRIMMED_BINARY_VERSION: ${{ steps.three.outputs.TRIMMED_BINARY_VERSION }} | |
steps: | |
- name: Get current plugin version | |
id: one | |
run: | | |
PLUGIN_RELEASE=$(gh release list -R ${{ github.repository }} -L 1) | |
echo "PLUGIN_VERSION=$(echo $PLUGIN_RELEASE | grep -oE "${{ env.SEMANTIC_VERSIONING_REGEX }}" | head -n1)" >> $GITHUB_OUTPUT | |
- name: Get current binary version | |
id: two | |
run: | | |
BINARY_RELEASE=$(gh release list -R ${{ env.BINARY_REPO }} -L 1) | |
echo "BINARY_VERSION=$(echo $BINARY_RELEASE | grep -oE "${{ env.SEMANTIC_VERSIONING_REGEX }}" | head -n1)" >> $GITHUB_OUTPUT | |
- name: Get trimmed binary version | |
id: three | |
run: | | |
# The example binary includes a leading 'v' in the release version number. We drop it on the next line. | |
echo "TRIMMED_BINARY_VERSION=$(echo ${{ steps.two.outputs.BINARY_VERSION }} | cut -c2-)" >> $GITHUB_OUTPUT | |
debug: | |
name: Debug Outputs | |
needs: check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print outputs from check job | |
run: | | |
echo "${{ needs.check.outputs.BINARY_NAME }}" | |
echo "${{ needs.check.outputs.BINARY_REPO }}" | |
echo "${{ needs.check.outputs.BINARY_VERSION }}" | |
echo "${{ github.repository }}" | |
echo "${{ needs.check.outputs.PLUGIN_VERSION }}" | |
echo "${{ needs.check.outputs.TRIMMED_BINARY_VERSION }}" | |
trigger: | |
name: Trigger Artifact Publish | |
needs: check | |
uses: ./.github/workflows/publish-artifact-bundle.yml | |
with: | |
binary_name: ${{ needs.check.outputs.BINARY_NAME }} | |
binary_repo: ${{ needs.check.outputs.BINARY_REPO }} | |
binary_version: ${{ needs.check.outputs.BINARY_VERSION }} | |
plugin_repo: ${{ github.repository }} | |
if: ${{ needs.check.outputs.PLUGIN_VERSION != needs.check.outputs.TRIMMED_BINARY_VERSION }} |