Release Package #11
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 | |
env: | |
NODE_VERSION: 20.13.1 | |
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: Configure git User | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
- 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 Node.js | |
uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Bump version and create changelog | |
run: | | |
npx 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 }} |