Release Package #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# yamllint disable rule:line-length | |
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 | |
# yamllint enable rule:line-length | |
- 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 | |
# yamllint disable-line rule:line-length | |
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 | |
# yamllint disable-line rule:line-length | |
run: git push origin release-${{ github.event.inputs.package }}@${{ steps.short_commit_hash.outputs.short_commit_hash }} | |
- name: Create pull request | |
# yamllint disable rule:line-length | |
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 }}" | |
# yamllint enable rule:line-length | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |