Skip to content

App Release (New)

App Release (New) #16

name: App Release (New)
on:
workflow_dispatch:
inputs:
base_commit:
description: 'Commit SHA to start release from (default: main HEAD)'
required: false
type: string
permissions:
contents: write
pull-requests: write
jobs:
prepare-release:
runs-on: ubuntu-latest
steps:
- name: Load secrets
id: load-secrets
uses: 1password/load-secrets-action@v4.0.0
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: '${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}'
GPG_PASSPHRASE: op://kv_app_infra/arabot-1_SIGN_CERTS/credential
GPG_PRIVATE_KEY: op://kv_app_infra/arabot-1_SIGN_CERTS/private_key
ARABOT_PAT: op://kv_app_infra/ARABOT_PAT/credential
SLACK_BOT_TOKEN: op://kv_app_infra/SLACK_BOT_TOKEN/credential
SLACK_CHANNEL_ID: op://kv_app_infra/SLACK_CHANNEL_ID/credential
LINEAR_API_TOKEN: op://kv_app_infra/LINEAR_API_TOKEN/credential
- name: Checkout actions
uses: actions/checkout@v6.0.2
with:
fetch-depth: 1
sparse-checkout: |
.github/actions/setup
- name: Setup
uses: ./.github/actions/setup
with:
token: ${{ steps.load-secrets.outputs.ARABOT_PAT }}
fetch-depth: 0
ref: ${{ inputs.base_commit || 'main' }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v7.0.0
with:
gpg_private_key: ${{ steps.load-secrets.outputs.GPG_PRIVATE_KEY }}
passphrase: ${{ steps.load-secrets.outputs.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Generate Release Branch Name
id: branch-name
run: echo "name=release/$(date +'%Y-%m-%d_%H-%M')" >> $GITHUB_OUTPUT
- name: Ensure Release Branch
uses: ./.github/actions/git-ensure-branch
with:
branch: ${{ steps.branch-name.outputs.name }}
base_ref: ${{ inputs.base_commit || 'main' }}
- name: Generate Release Summary
id: release-summary
uses: ./.github/actions/generate-release-summary
with:
linear_api_token: ${{ steps.load-secrets.outputs.LINEAR_API_TOKEN }}
- name: Update version and changelog
uses: ./.github/actions/changeset-version
with:
prettier_changelog: "true"
github_token: ${{ steps.load-secrets.outputs.ARABOT_PAT }}
- name: Get package version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
- name: Commit changes
run: |
git add --all
git commit -am "Release v${{ steps.package-version.outputs.current-version}}"
git push origin ${{ steps.branch-name.outputs.name }}
- name: Ensure Pull Request
id: create-pr
uses: ./.github/actions/gh-ensure-pr
with:
base: main
head: ${{ steps.branch-name.outputs.name }}
title: Release v${{ steps.package-version.outputs.current-version }}
body: ${{ steps.release-summary.outputs.summary }}
token: ${{ steps.load-secrets.outputs.ARABOT_PAT }}
- name: Notify Slack
id: slack
if: steps.load-secrets.outputs.SLACK_BOT_TOKEN != ''
uses: ./.github/actions/slack-notify
with:
slack_bot_token: ${{ steps.load-secrets.outputs.SLACK_BOT_TOKEN }}
slack_channel_id: ${{ steps.load-secrets.outputs.SLACK_CHANNEL_ID }}
message: |
🚀 *Release v${{ steps.package-version.outputs.current-version }} Started*
*PR:* ${{ steps.create-pr.outputs.url }}
${{ steps.release-summary.outputs.summary }}
- name: Update PR with Slack TS
if: steps.slack.outputs.ts != ''
uses: ./.github/actions/gh-pr-edit-body
with:
pr_number: ${{ steps.create-pr.outputs.number }}
token: ${{ steps.load-secrets.outputs.ARABOT_PAT }}
body: |
${{ steps.release-summary.outputs.summary }}
<!-- slack_ts: ${{ steps.slack.outputs.ts }} -->