Skip to content

Release

Release #6

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
dry-run:
description: "Dry run the release"
required: false
default: "false"
jobs:
prepare:
name: Prepare Release
runs-on: ubuntu-latest
outputs:
new-release-version: ${{ steps.semantic.outputs.new-release-version }}
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.GH_BOT_CLIENT_ID }}
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Install Modules
run: |
npm install \
@semantic-release/git \
@semantic-release/changelog \
@semantic-release/exec
- name: Determine next version
id: semantic
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: npx semantic-release --dry-run
build:
name: Build
needs: prepare
if: needs.prepare.outputs.new-release-version != ''
uses: ./.github/workflows/build.yml
with:
version: v${{ needs.prepare.outputs.new-release-version }}
secrets: inherit
release:
name: Create Release
needs: [prepare, build]
if: inputs.dry-run != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.GH_BOT_CLIENT_ID }}
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- name: Get bot user ID
id: bot-user-id
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Install Modules
run: |
npm install \
@semantic-release/git \
@semantic-release/changelog \
@semantic-release/exec
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
pattern: lumos-*-v${{ needs.prepare.outputs.new-release-version }}
merge-multiple: true
- name: List downloaded artifacts
run: ls -la lumos-*.tar.gz
- name: Create Release
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GIT_AUTHOR_EMAIL: "${{ steps.bot-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
GIT_COMMITTER_EMAIL: "${{ steps.bot-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
run: npx semantic-release
release-homebrew:
name: Release Homebrew Tap
needs: [prepare, release]
if: inputs.dry-run != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.GH_BOT_CLIENT_ID }}
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
repositories: homebrew-tap
- name: Trigger homebrew-tap release
run: |
curl -X POST \
-H "Authorization: token ${{ steps.app-token.outputs.token }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/teamlumos/homebrew-tap/dispatches \
-d '{"event_type": "release", "client_payload": {"version": "v${{ needs.prepare.outputs.new-release-version }}"}}'