chore(release): automate changelog and assets
This commit is contained in:
parent
c3e622be5d
commit
b70f49cbef
138
.github/workflows/release-assets.yml
vendored
Normal file
138
.github/workflows/release-assets.yml
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
name: release-assets
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: windows
|
||||
runs-on: windows-latest
|
||||
artifact_name: ocswitch-desktop-windows-amd64
|
||||
package: release/ocswitch-desktop-windows-amd64.zip
|
||||
output: build/bin/ocswitch-desktop.exe
|
||||
- name: macos
|
||||
runs-on: macos-13
|
||||
artifact_name: ocswitch-desktop-darwin-amd64
|
||||
package: release/ocswitch-desktop-darwin-amd64.zip
|
||||
output: build/bin/ocswitch-desktop.app
|
||||
- name: linux
|
||||
runs-on: ubuntu-22.04
|
||||
artifact_name: ocswitch-desktop-linux-amd64
|
||||
package: release/ocswitch-desktop-linux-amd64.zip
|
||||
output: build/bin/ocswitch-desktop
|
||||
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install frontend deps
|
||||
working-directory: frontend
|
||||
run: npm install
|
||||
|
||||
- name: Install Wails CLI
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.12.0
|
||||
|
||||
- name: Install Linux deps
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
|
||||
|
||||
- name: Verify Wails output name
|
||||
shell: bash
|
||||
env:
|
||||
EXPECTED_OUTPUT: ${{ matrix.output }}
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
expected = pathlib.Path(os.environ["EXPECTED_OUTPUT"])
|
||||
print(f"expected output: {expected.as_posix()}")
|
||||
PY
|
||||
|
||||
- name: Build desktop app
|
||||
run: wails build -tags desktop_wails
|
||||
|
||||
- name: Package artifact
|
||||
shell: bash
|
||||
env:
|
||||
SOURCE_PATH: ${{ matrix.output }}
|
||||
DEST_PATH: ${{ matrix.package }}
|
||||
run: |
|
||||
mkdir -p release
|
||||
python - <<'PY'
|
||||
import hashlib
|
||||
import os
|
||||
import pathlib
|
||||
import zipfile
|
||||
|
||||
source = pathlib.Path(os.environ["SOURCE_PATH"])
|
||||
dest = pathlib.Path(os.environ["DEST_PATH"])
|
||||
dest.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with zipfile.ZipFile(dest, "w", compression=zipfile.ZIP_DEFLATED) as zf:
|
||||
if source.is_dir():
|
||||
for path in source.rglob("*"):
|
||||
if path.is_file():
|
||||
zf.write(path, arcname=f"{source.name}/{path.relative_to(source).as_posix()}")
|
||||
else:
|
||||
zf.write(source, arcname=source.name)
|
||||
|
||||
digest = hashlib.sha256(dest.read_bytes()).hexdigest()
|
||||
dest.with_suffix(dest.suffix + ".sha256").write_text(f"{digest} {dest.name}\n", encoding="ascii")
|
||||
PY
|
||||
|
||||
- name: List packaged files
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import pathlib
|
||||
|
||||
for path in sorted(pathlib.Path("release").glob("**/*")):
|
||||
if path.is_file():
|
||||
print(path.as_posix())
|
||||
PY
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact_name }}
|
||||
path: |
|
||||
${{ matrix.package }}
|
||||
${{ matrix.package }}.sha256
|
||||
|
||||
publish:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: release-assets
|
||||
merge-multiple: true
|
||||
|
||||
- name: Publish GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: release-assets/**
|
||||
22
.github/workflows/release-please.yml
vendored
Normal file
22
.github/workflows/release-please.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
name: release-please
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Release Please
|
||||
uses: googleapis/release-please-action@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
config-file: release-please-config.json
|
||||
manifest-file: .release-please-manifest.json
|
||||
15
.github/workflows/release-precheck.md
vendored
Normal file
15
.github/workflows/release-precheck.md
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# Release Workflow Precheck
|
||||
|
||||
1. Confirm release-please is enabled on `master`.
|
||||
2. Confirm conventional commits are used for release notes grouping.
|
||||
3. Confirm `release-please-config.json` targets the repo root and `CHANGELOG.md`.
|
||||
4. Confirm Wails output name matches `wails.json`:
|
||||
- `build/bin/ocswitch-desktop.exe` on Windows
|
||||
- `build/bin/ocswitch-desktop.app` on macOS
|
||||
- `build/bin/ocswitch-desktop` on Linux
|
||||
5. Confirm Linux runner has the GTK/WebKit packages needed by Wails.
|
||||
6. Confirm `npm install` is sufficient for frontend build in CI.
|
||||
7. Confirm release assets are uploaded only after the GitHub Release is published.
|
||||
8. Confirm each asset has a matching `.sha256` file.
|
||||
9. Confirm tag format is `v*`.
|
||||
10. Confirm the generated release contains the three platform archives.
|
||||
3
.release-please-manifest.json
Normal file
3
.release-please-manifest.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
".": "0.0.0"
|
||||
}
|
||||
9
release-please-config.json
Normal file
9
release-please-config.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
||||
"packages": {
|
||||
".": {
|
||||
"release-type": "go",
|
||||
"changelog-path": "CHANGELOG.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user