@@ -0,0 +1,63 @@
3+# Every push to master builds the extension and publishes it as a GitHub release.
4+# The version is the commit's timestamp in UTC, YYYY.MM.DD.HHMM, used as the tag and release name.
13+ group: release-${{ github.sha }}
17+ runs-on: ubuntu-latest
19+ - uses: actions/checkout@v4
21+ - uses: actions/setup-node@v4
26+ - uses: actions/setup-python@v5
28+ python-version: "3.12"
30+ - name: Install dependencies
33+ - name: Version from commit time
36+ version=$(TZ=UTC git log -1 --format=%cd --date=format-local:%Y.%m.%d.%H%M "$GITHUB_SHA")
37+ echo "version=$version" >> "$GITHUB_OUTPUT"
38+ echo "Version $version"
40+ - name: Typecheck and test
45+ DIAGONAL_VERSION: ${{ steps.version.outputs.version }}
48+ (cd dist && zip -qr "../diagonal-extension-${DIAGONAL_VERSION}.zip" .)
49+ cat dist/manifest.json | head -5
51+ - name: Publish release
53+ GH_TOKEN: ${{ github.token }}
54+ VERSION: ${{ steps.version.outputs.version }}
56+ asset="diagonal-extension-${VERSION}.zip"
57+ notes="Built from ${GITHUB_SHA::7}. Unzip and load the folder at brave://extensions (Developer mode → Load unpacked)."
58+ if gh release view "$VERSION" >/dev/null 2>&1; then
59+ # Two commits in the same minute share a version: refresh the asset on the existing release.
60+ gh release upload "$VERSION" "$asset" --clobber
62+ gh release create "$VERSION" "$asset" --target "$GITHUB_SHA" --title "Diagonal $VERSION" --notes "$notes"