diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0822eac --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +# SPDX-License-Identifier: AGPL-3.0-or-later + +name: Release + +on: + push: + branches: + - main + paths: + - VERSION + workflow_dispatch: + +permissions: + contents: write + +concurrency: + group: release + cancel-in-progress: false + +jobs: + release: + name: Publish versioned release + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Read and validate version + id: version + shell: bash + run: | + set -euo pipefail + version="$(tr -d '[:space:]' < VERSION)" + if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "VERSION must use MAJOR.MINOR.PATCH" >&2 + exit 1 + fi + echo "version=$version" >> "$GITHUB_OUTPUT" + echo "tag=v$version" >> "$GITHUB_OUTPUT" + + - name: Run project checks + run: | + python3 -m unittest discover -s tests -p 'test_*.py' + python3 scripts/sync_upstream.py check upstream/sources.json + python3 scripts/render_upstream.py check upstream/templates.json + python3 scripts/check_workflow_policy.py + + - name: Publish GitHub release + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ steps.version.outputs.tag }} + shell: bash + run: | + set -euo pipefail + if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then + echo "Release $TAG already exists; nothing to do." + exit 0 + fi + + gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" --title "$TAG" --generate-notes diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/VERSION.license b/VERSION.license new file mode 100644 index 0000000..1ce4e0c --- /dev/null +++ b/VERSION.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2026 LibreCode coop and contributors +SPDX-License-Identifier: AGPL-3.0-or-later