Skip to content

Release

Release #28

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: Version bump
required: true
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
jobs:
version:
name: Bump Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.bump.outputs.version }}
tag: ${{ steps.bump.outputs.tag }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Bump version
id: bump
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
NEW=$(npm version ${{ inputs.version }} -m "release: %s")
echo "version=${NEW#v}" >> $GITHUB_OUTPUT
echo "tag=$NEW" >> $GITHUB_OUTPUT
git push --follow-tags
build:
name: Build ${{ matrix.name }}
needs: version
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
name: mac-apple-silicon
arch: arm64
- os: macos-latest
name: mac-intel
arch: x64
- os: windows-latest
name: windows
- os: ubuntu-latest
name: linux
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.version.outputs.tag }}
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- name: Linux deps
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y rpm libarchive-tools
- name: macOS deps
if: matrix.os == 'macos-latest'
run: brew install python-setuptools
- name: Publish
run: npm run publish ${{ matrix.arch && format('-- --arch={0}', matrix.arch) || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
finalize:
name: Finalize Release
needs: [version, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Pull latest (includes version bump)
run: git pull origin main
- name: Generate release notes
id: changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --tag ${{ needs.version.outputs.tag }} --strip header
env:
GITHUB_REPO: ${{ github.repository }}
OUTPUT: release-notes.md
- name: Update CHANGELOG.md
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --tag ${{ needs.version.outputs.tag }}
env:
GITHUB_REPO: ${{ github.repository }}
OUTPUT: CHANGELOG.md
- name: Commit CHANGELOG.md
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git diff --staged --quiet || git commit -m "docs: update CHANGELOG.md for ${{ needs.version.outputs.tag }}"
git push
- name: Append footer to release notes
run: |
cat >> release-notes.md << 'EOF'
---
If you find this useful, consider giving it a :star:, it helps others discover the project.
> :apple: **macOS Users:** Please read the [installation instructions](https://github.com/${{ github.repository }}#readme) before opening the app.
EOF
- name: Update release with changelog
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.version.outputs.tag }}
draft: false
body_path: release-notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Discord
continue-on-error: true
env:
NOTES: ${{ steps.changelog.outputs.content }}
uses: tsickert/discord-webhook@v7.0.0
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
embed-title: "X-Dispatch ${{ needs.version.outputs.tag }} Released"
embed-url: "https://github.com/${{ github.repository }}/releases/tag/${{ needs.version.outputs.tag }}"
embed-description: ${{ env.NOTES }}
embed-color: 3447003