From 18cc4b8f727dffc280de298b77938087e93b78e6 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 10 Sep 2023 16:48:01 -0700 Subject: [PATCH] Updates --- .github/workflows/check-github-release.yml | 11 +++++++++-- .github/workflows/publish-artifact-bundle.yml | 18 +++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check-github-release.yml b/.github/workflows/check-github-release.yml index b541430..64f1c1f 100644 --- a/.github/workflows/check-github-release.yml +++ b/.github/workflows/check-github-release.yml @@ -12,6 +12,7 @@ jobs: name: Check GitHub Release runs-on: macOS-13 env: + BINARY_NAME: lefthook BINARY_REPO: evilmartians/lefthook PLUGIN_REPO: gigabitcoin/template-plugin GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -25,8 +26,14 @@ jobs: echo "PLUGIN_VERSION=$(echo $PLUGIN_RELEASE | grep -oE $SEMANTIC_VERSIONING_REGEX | head -n1)" >> $GITHUB_ENV echo "BINARY_VERSION=$(echo $BINARY_RELEASE | grep -oE $SEMANTIC_VERSIONING_REGEX | head -n1)" >> $GITHUB_ENV + - name: Update GitHub Env Vars + 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 $BINARY_VERSION | cut -c2-)" >> $GITHUB_ENV - uses: ./.github/workflows/publish-artifact-bundle.yml with: - plugin_version: ${{ env.PLUGIN_VERSION }} + binary_name: ${{ env.BINARY_NAME }} + binary_repo: ${{ env.BINARY_REPO }} + binary_version: ${{ env.BINARY_RELEASE }} plugin_repo: ${{ env.PLUGIN_REPO }} - if: ${{ env.PLUGIN_VERSION == env.BINARY_VERSION }} \ No newline at end of file + if: ${{ env.PLUGIN_VERSION == env.TRIMMED_BINARY_VERSION }} \ No newline at end of file diff --git a/.github/workflows/publish-artifact-bundle.yml b/.github/workflows/publish-artifact-bundle.yml index 97a7fcb..ed1c443 100644 --- a/.github/workflows/publish-artifact-bundle.yml +++ b/.github/workflows/publish-artifact-bundle.yml @@ -3,26 +3,32 @@ name: Publish Artifact Bundle on: workflow_call: inputs: - binary_version: + binary_name: required: true type: string binary_repo: required: true type: string - binary_name: + binary_version: + required: true + type: string + plugin_repo: required: true type: string # Enables manually running this workflow from the Actions tab workflow_dispatch: inputs: - binary_version: + binary_name: required: true type: string binary_repo: required: true type: string - binary_name: + binary_version: + required: true + type: string + plugin_repo: required: true type: string @@ -71,10 +77,8 @@ jobs: (cd ${{ inputs.binary_name }} && git reset --hard) - name: Update Package.swift run: | - echo ${{ hashFiles( env.ARTIFACT_NAME ) }} sed -i '' 's/checksum: ".*"/checksum: "${{ hashFiles( env.ARTIFACT_NAME ) }}"/g' ${{ inputs.binary_name }}/Package.swift sed -i '' -E "s/\/[0-9]+\.[0-9]+\.[0-9]+\//\/1.4.10\//" ${{ inputs.binary_name }}/Package.swift - cat ${{ inputs.binary_name }}/Package.swift - name: Push Changes to GitHub run: | (cd ${{ inputs.binary_name }} && git commit -am "Updating ${{ inputs.binary_name }} to ${{ env.PLUGIN_VERSION }}" && git push origin) @@ -82,7 +86,7 @@ jobs: run: | echo $(cd ${{ inputs.binary_name }} && git rev-parse HEAD) gh release create ${{ env.PLUGIN_VERSION }} \ - -R "gigabitcoin/template-plugin" \ + -R ${{ inputs.plugin_repo }} \ --target $(cd ${{ inputs.binary_name }} && git rev-parse HEAD) \ ${{ env.ARTIFACT_NAME }} env: