add tag to zip #5
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: Tag | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check version change | |
id: check | |
run: | | |
latest=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r .tag_name) | |
current=$(grep -oP 'version="\K[^"]+' addons/talo/plugin.cfg) | |
if [[ -z "$latest" ]]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
echo "version=$current" >> $GITHUB_OUTPUT | |
elif [[ "$latest" != "$current" ]]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
echo "version=$current" >> $GITHUB_OUTPUT | |
else | |
echo "changed=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create tag | |
if: steps.check.outputs.changed == 'true' | |
uses: pxpm/[email protected] | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.check.outputs.version }} | |
- name: Trigger workflow | |
if: steps.check.outputs.changed == 'true' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: 'create-release.yml', | |
ref: '${{ steps.check.outputs.version }}' | |
}) |