ci: add semrel-release workflow and update .semrel.yaml #1
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
| # SPDX-License-Identifier: Apache-2.0 | |
| # SPDX-FileCopyrightText: 2026 The semrel Authors | |
| # | |
| # semrel-release — uses semrel to version this plugin. | |
| # Flow: push to main → semrel creates tag → release.yml builds binaries + publishes release | |
| # | |
| # condition-github-actions is installed from its published v0.1.0 release. | |
| name: Semrel Release | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: semrel-release | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: Run semrel | |
| runs-on: ubuntu-latest | |
| outputs: | |
| released: ${{ steps.semrel.outputs.released }} | |
| tag: ${{ steps.semrel.outputs.tag }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: stable | |
| cache: false | |
| - name: Download semrel binary | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| VERSION=$(gh release view --repo SemRels/semrel --json tagName -q .tagName) | |
| gh release download "$VERSION" --repo SemRels/semrel \ | |
| --pattern "semrel_*_linux_amd64.tar.gz" --dir /tmp | |
| tar -xzf /tmp/semrel_*_linux_amd64.tar.gz -C /tmp | |
| chmod +x /tmp/semrel | |
| echo "semrel $(/tmp/semrel version)" | |
| - name: Install condition-github-actions plugin | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| PLUGIN_DIR="$HOME/.semrel/plugins" | |
| mkdir -p "$PLUGIN_DIR" | |
| # Use the published v0.1.0 release binary (linux/amd64 in CI) | |
| gh release download v0.1.0 \ | |
| --repo SemRels/condition-github-actions \ | |
| --pattern "plugin-linux-amd64" \ | |
| --dir "$PLUGIN_DIR" | |
| mv "$PLUGIN_DIR/plugin-linux-amd64" "$PLUGIN_DIR/semrel-plugin-condition-github-actions" | |
| chmod +x "$PLUGIN_DIR/semrel-plugin-condition-github-actions" | |
| - name: Configure git identity | |
| run: | | |
| git config user.name "semrel-bot" | |
| git config user.email "semrel-bot@users.noreply.github.com" | |
| - name: Run semrel release | |
| id: semrel | |
| run: /tmp/semrel release --github-output | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push tag to GitHub | |
| if: steps.semrel.outputs.released == 'true' | |
| run: | | |
| TAG="${{ steps.semrel.outputs.tag }}" | |
| if git ls-remote --tags origin "$TAG" | grep -q "$TAG"; then | |
| echo "Tag $TAG already exists on remote — skipping (idempotent)." | |
| else | |
| git push origin "refs/tags/$TAG" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Summary | |
| run: | | |
| if [ "${{ steps.semrel.outputs.released }}" = "true" ]; then | |
| echo "### Released ${{ steps.semrel.outputs.tag }} 🚀" >> $GITHUB_STEP_SUMMARY | |
| echo "**Bump:** ${{ steps.semrel.outputs.bump }}" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "### No release — no releasable commits found." >> $GITHUB_STEP_SUMMARY | |
| fi |