1.5.1 #13
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: "push-tag" | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'manifest.json' | |
jobs: | |
push-tag: | |
name: "Push tag" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Checkout Repository" | |
uses: "actions/checkout@v4" | |
with: | |
ssh-key: "${{ secrets.COMMIT_KEY }}" | |
fetch-depth: 16 # Ensure we can get the previous version | |
- name: "Read versions from manifest" | |
id: read-versions | |
run: | | |
version=$(sed -n 's/.*"version": "\(.*\)",/\1/p' manifest.json) | |
echo "version=$version" >> "$GITHUB_OUTPUT" | |
echo "Version: $version" | |
previous_version=$(git show HEAD^:manifest.json | sed -n 's/.*"version": "\(.*\)",/\1/p') | |
echo "previous-version=$previous_version" >> "$GITHUB_OUTPUT" | |
echo "Previous version: $previous_version" | |
- name: "Push tag" | |
if: ${{ steps.read-versions.outputs.version != steps.read-versions.outputs.previous-version }} | |
run: | | |
git config user.email "actions@github.com" | |
git config user.name "GitHub Actions" | |
echo "Creating a tag..." | |
git tag -a "v${{ steps.read-versions.outputs.version }}" -m "Release v${{ steps.read-versions.outputs.version }}" | |
git push origin "v${{ steps.read-versions.outputs.version }}" | |
echo "Done!" |