Skip to content

Merge pull request #114 from git-stunts/fix/release-acquisition #127

Merge pull request #114 from git-stunts/fix/release-acquisition

Merge pull request #114 from git-stunts/fix/release-acquisition #127

Workflow file for this run

name: ci
on:
push:
branches: [main]
pull_request:
jobs:
unicode-without-en-us:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test absent en_US locale inside the isolated Docker worker
run: python3 scripts/docker-run.py bash test/unicode-missing-locale.sh
- uses: actions/upload-artifact@v4
if: always()
with:
name: unicode-docker-receipts
path: .test-results/
include-hidden-files: true
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint and test copied inputs without host mounts or networking
run: python3 scripts/docker-run.py make lint-container test-container
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-docker-receipts
path: .test-results/
include-hidden-files: true
release:
needs: [lint-and-test, unicode-without-en-us]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Tag and release when VERSION has no tag yet
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
version="$(sed -n "s/^VERSION='\(.*\)'$/\1/p" bin/git-locks)" # the built script; lib/000-prelude.sh is the source
[ -n "$version" ] || { echo "no VERSION in bin/git-locks"; exit 1; }
tag="v${version}"
if git rev-parse -q --verify "refs/tags/${tag}" >/dev/null 2>&1 || gh release view "$tag" >/dev/null 2>&1; then
echo "${tag} already exists; nothing to release"
exit 0
fi
notes="$(awk -v v="$version" '$0 ~ "^## \\[" v "\\]" {f=1; next} /^## \[/ {if (f) exit} f' CHANGELOG.md)"
[ -n "$notes" ] || { echo "CHANGELOG.md has no section for ${version}"; exit 1; }
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "$tag" -m "git-locks ${version}"
git push origin "$tag"
gh release create "$tag" --title "git-locks ${tag}" --notes "$notes" bin/git-locks schema/git-locks.schema.json