Skip to content

feat: auto release on tag #30

feat: auto release on tag

feat: auto release on tag #30

Workflow file for this run

name: Release

Check failure on line 1 in .github/workflows/publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish.yml

Invalid workflow file

(Line: 8, Col: 3): Unexpected value 'tags', (Line: 9, Col: 7): A sequence was not expected
# Triggered by pushing a semver tag (e.g. v2.1.3).
# 1. Creates a GitHub Release with auto-generated notes.
# 2. Builds dist/ and force-pushes action.yml + dist/ to the tag.
# 3. Updates the major version tag (v2.1.3 -> v2).
on:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
notify-start:
runs-on: ubuntu-latest
steps:
- uses: kosli-dev/reusable-actions/slack-release-notify@main
with:
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel-id: ${{ vars.SLACK_CHANNEL_ID }}
stage: start
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Install deps and build
run: npm ci && npm run build
- name: Create GitHub Release with auto-generated notes
uses: softprops/action-gh-release@v3
with:
generate_release_notes: true
# Mark as prerelease if the tag contains a hyphen (e.g. v2.1.3-beta.1).
prerelease: ${{ contains(github.ref_name, '-') }}
- name: Build and tag (force-pushes dist/ to the tag and updates major/minor refs)
uses: JasonEtco/build-and-tag-action@v2
env:
GITHUB_TOKEN: ${{ github.token }}
notify-finish:
needs: [notify-start, build]
if: always() && needs.notify-start.result == 'success'
runs-on: ubuntu-latest
permissions:
actions: read # ← needed to fetch run_started_at for duration
contents: read # ← needed to read release notes via `gh release view`
steps:
- name: Determine status
id: status
run: |
if [[ "${{ needs.build.result }}" == "success" ]]; then
echo "value=success" >> "$GITHUB_OUTPUT"
else
echo "value=failure" >> "$GITHUB_OUTPUT"
fi
- uses: kosli-dev/reusable-actions/slack-release-notify@main
with:
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel-id: ${{ vars.SLACK_CHANNEL_ID }}
stage: finish
status: ${{ steps.status.outputs.value }}