| 1 |
name: release |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ main ] |
| 6 |
paths: [ CHANGELOG.md ] |
| 7 |
|
| 8 |
jobs: |
| 9 |
release: |
| 10 |
runs-on: ubuntu-latest |
| 11 |
permissions: |
| 12 |
id-token: write |
| 13 |
contents: write |
| 14 |
packages: write |
| 15 |
|
| 16 |
steps: |
| 17 |
|
| 18 |
- name: Checkout |
| 19 |
uses: actions/checkout@v7 |
| 20 |
|
| 21 |
- name: Setup Go |
| 22 |
uses: actions/setup-go@v7 |
| 23 |
with: |
| 24 |
go-version-file: 'go.mod' |
| 25 |
|
| 26 |
- name: Setup NPM |
| 27 |
uses: actions/setup-node@v7 |
| 28 |
with: |
| 29 |
node-version: '24.x' |
| 30 |
registry-url: 'https://registry.npmjs.org' |
| 31 |
|
| 32 |
- name: Login to GitHub Container Registry |
| 33 |
uses: docker/[email protected] |
| 34 |
with: |
| 35 |
registry: ghcr.io |
| 36 |
username: ${{ github.repository_owner }} |
| 37 |
password: ${{ secrets.GITHUB_TOKEN }} |
| 38 |
|
| 39 |
- name: Add env vars |
| 40 |
run: | |
| 41 |
echo GORELEASER_CURRENT_TAG=$(go run main.go latest) >> $GITHUB_ENV |
| 42 |
tail -n +3 .changes/$(go run main.go latest).md > '${{ github.workspace }}/rel_notes.md' |
| 43 |
|
| 44 |
- name: Run GoReleaser |
| 45 |
uses: goreleaser/[email protected] |
| 46 |
with: |
| 47 |
version: latest |
| 48 |
args: --clean --release-notes="${{ github.workspace}}/rel_notes.md" --skip=validate --verbose |
| 49 |
env: |
| 50 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 |
WINGET_PAT: ${{ secrets.WINGET_PAT }} |
| 52 |
|
| 53 |
- uses: actions/setup-python@v7 |
| 54 |
with: |
| 55 |
python-version: 3.x |
| 56 |
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV |
| 57 |
- uses: actions/cache@v6 |
| 58 |
with: |
| 59 |
key: mkdocs-material-${{ env.cache_id }} |
| 60 |
path: .cache |
| 61 |
restore-keys: | |
| 62 |
mkdocs-material- |
| 63 |
|
| 64 |
- name: Publish to NPM |
| 65 |
run: | |
| 66 |
node npm/prepare-release.mjs |
| 67 |
npm publish --provenance |
| 68 |
|
| 69 |
- name: Build docs |
| 70 |
run: | |
| 71 |
go run main.go gen |
| 72 |
pip install -r requirements.txt |
| 73 |
mkdocs build |
| 74 |
|
| 75 |
- name: Deploy docs |
| 76 |
uses: peaceiris/[email protected] |
| 77 |
with: |
| 78 |
github_token: ${{ secrets.GITHUB_TOKEN }} |
| 79 |
publish_dir: ./site |
| 80 |
cname: changie.dev |