# .gitea/workflows/version.yml # # Reusable Gitea Actions workflow that: # - computes the next semantic version from commit-message tokens # - writes VERSION.md in the repo root # - on the main branch, creates a git tag and a Gitea release when # MAJOR, MINOR, or PATCH actually changed # # Drop this file in at `.gitea/workflows/version.yml` and edit the two # values in the `Install semver-ci` step that point at your small-scripts # repo if they differ from the defaults. # # Requirements: # - Gitea Actions enabled for the repo # - A `GITEA_TOKEN` secret with write access to the repo (used for # creating the release). `GITHUB_TOKEN` is also provided automatically # by Gitea Actions and is accepted as a fallback. # - Commit triggers: put NEW_MAJOR, NEW_MINOR, or NEW_PATCH on a line # of its own in a commit message to bump the corresponding part. name: version on: push: # Don't re-trigger when we push the tag we just created. tags-ignore: - 'v*' jobs: version: runs-on: ubuntu-latest steps: - name: Checkout (full history for tags) uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install semver-ci env: # Edit these two if small-scripts lives elsewhere. SMALL_SCRIPTS_REPO: skynet/small-scripts SMALL_SCRIPTS_REF: main GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: | set -euo pipefail auth=() [ -n "${GITEA_TOKEN:-}" ] && auth=(-H "Authorization: token ${GITEA_TOKEN}") curl -fsSL "${auth[@]}" \ "${GITHUB_SERVER_URL%/}/${SMALL_SCRIPTS_REPO}/raw/branch/${SMALL_SCRIPTS_REF}/scripts/semver-ci" \ -o /usr/local/bin/semver-ci chmod +x /usr/local/bin/semver-ci - name: Compute version & release id: ver run: semver-ci --release env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} - name: Upload VERSION.md uses: actions/upload-artifact@v4 with: name: version path: VERSION.md if-no-files-found: warn - name: Print summary run: | echo "Version: ${{ steps.ver.outputs.version }}" echo "Tag: ${{ steps.ver.outputs.tag }}" echo "Branch: ${{ steps.ver.outputs.branch }}" echo "Is main: ${{ steps.ver.outputs.is_main }}" echo "Released: ${{ steps.ver.outputs.released }}"