Merge pull request #141 from codfish/renovate/eslint-monorepo #8
This file contains hidden or 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: Auto Tag | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| auto-tag: | |
| name: Auto-tag based on json-server version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.tag.outputs.version }} | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create or update tag | |
| id: tag | |
| run: | | |
| VERSION=$(jq -r '.dependencies["json-server"]' package.json) | |
| if [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; then | |
| echo "Error: Could not extract json-server version from package.json" | |
| exit 1 | |
| fi | |
| LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "json-server version: $VERSION" | |
| echo "Latest tag: $LATEST_TAG" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| if [ "$LATEST_TAG" = "$VERSION" ]; then | |
| echo "Tag $VERSION already exists, updating to current commit..." | |
| git tag -fa "$VERSION" -m "Update $VERSION tag" | |
| git push origin "$VERSION" --force | |
| else | |
| echo "Creating new tag $VERSION..." | |
| git tag -a "$VERSION" -m "$VERSION" | |
| git push origin "$VERSION" --force | |
| fi | |
| release: | |
| needs: auto-tag | |
| uses: ./.github/workflows/release.yml | |
| with: | |
| version: ${{ needs.auto-tag.outputs.version }} | |
| secrets: inherit |