Skip to content

feat: add release automation workflow for main branch #1

feat: add release automation workflow for main branch

feat: add release automation workflow for main branch #1

name: Release main-latest bundle

Check failure on line 1 in .github/workflows/release-main-latest.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release-main-latest.yml

Invalid workflow file

(Line: 68, Col: 1): Unexpected value 'Source commit', (Line: 69, Col: 1): Unexpected value 'Updated'
on:
push:
branches:
- main
permissions:
contents: write
concurrency:
group: release-main-latest
cancel-in-progress: true
jobs:
release-main-latest:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build minified bundle
run: npm run build
- name: Verify release asset exists
run: |
if [ ! -f dist/bind-manager.min.js ]; then
echo "Missing dist/bind-manager.min.js after build"
exit 1
fi
- name: Ensure rolling release exists
env:
GH_TOKEN: ${{ github.token }}
run: |
if ! gh release view main-latest >/dev/null 2>&1; then
gh release create main-latest \
--title "Bind Manager main-latest" \
--notes "Rolling release for the latest commit on main."
fi
- name: Upload latest minified bundle
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload main-latest dist/bind-manager.min.js --clobber
- name: Refresh release notes
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release edit main-latest \
--title "Bind Manager main-latest" \
--notes "Rolling release for the latest commit on main.
Source commit: $GITHUB_SHA
Updated: $(date -u +'%Y-%m-%dT%H:%M:%SZ')"