Skip to content

Release Package

Release Package #53

name: Release Package
on:
workflow_dispatch:
inputs:
package:
type: choice
description: package
options:
- barcode
- channable
- clockify-enhanced
- cronhooks
- fulfillmenttools
- google-enhanced
- kaufland-marketplace
- moco
- otto-market
- sentry-io-enhanced
permissions:
contents: write
pull-requests: write
jobs:
release-package:
name: Release Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
filter: 'blob:none'
fetch-depth: 0
fetch-tags: true
- name: Check on existing release branch
run: |
if git ls-remote --heads origin | grep "refs/heads/release-${{ github.event.inputs.package }}@*"; then
echo "::error ::Release branch already exists for package: \"${{ github.event.inputs.package }}\" please remove or merge branch before executing again."
exit 1
fi
- name: Setup git user
uses: fregante/setup-git-user@v2
- name: Retrieve short commit hash
id: short_commit_hash
run: echo "short_commit_hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Switch to release branch
run: git switch --force-create release-${{ github.event.inputs.package }}@${{ steps.short_commit_hash.outputs.short_commit_hash }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
node-version-file: package.json
- name: Install dependencies
run: pnpm install
- name: Bump version and create changelog
run: |
pnpm exec nx release \
--projects=${{ github.event.inputs.package }} \
--skip-publish
- name: Push changes
run: git push origin release-${{ github.event.inputs.package }}@${{ steps.short_commit_hash.outputs.short_commit_hash }}
- name: Create pull request
run: |
gh pr create \
--base main \
--body "This is an automated pull request to create a new release of the package ${{ github.event.inputs.package }}." \
--head release-${{ github.event.inputs.package }}@${{ steps.short_commit_hash.outputs.short_commit_hash }} \
--label release \
--reviewer ${{ github.actor }} \
--title "Release ${{ github.event.inputs.package }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}