forked from segmentio/action-destinations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce new release flow - Part 1 (segmentio#2143)
* Introduce new release flow * quick check to validate push permissios * revert changes * refactor release.sh * revert release.sh * Revert unwanted changes * Restore gh pat token change
- Loading branch information
1 parent
8db747a
commit 93087d2
Showing
4 changed files
with
121 additions
and
23 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# This workflow is triggered manually via the GitHub Actions page or API | ||
name: Version Packages | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'Branch to create PR from' | ||
required: true | ||
default: 'release-actions' | ||
|
||
jobs: | ||
build-and-version-packages: | ||
env: | ||
HUSKY: 0 | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
depth: 0 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
registry-url: 'https://registry.npmjs.org' | ||
cache: yarn | ||
|
||
- name: Checkout branch | ||
run: | | ||
git checkout -b ${{ github.event.inputs.branch }} | ||
git push origin ${{ github.event.inputs.branch }} | ||
- name: Install Dependencies | ||
run: yarn install --frozen-lockfile --ignore-optional | ||
|
||
- name: Configure git | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
- name: Build | ||
run: NODE_ENV=production yarn build | ||
|
||
- name: Version Packages | ||
run: yarn lerna version minor --allow-branch ${{ github.event.inputs.branch }} --no-git-tag-version --no-commit-hooks --no-private --yes | ||
|
||
- name: Commit and push | ||
id: commit_and_push | ||
run: | | ||
count=$(git diff --cached --stat) | ||
if [ -z "$count" ]; then | ||
echo "No changes to commit" | ||
echo "SKIP_PR=true" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
git add . | ||
git commit -m "chore: version packages" | ||
git push origin ${{ github.event.inputs.branch }} | ||
- name: Create PR | ||
if: ${{ steps.commit_and_push.outputs.SKIP_PR != 'true' }} | ||
run: | | ||
packages_published=$(git status -s -uno| grep "package.json" |awk '{print $2}'| xargs jq -r '.name + "@" + .version' --argjson null {}) | ||
pr_message="This PR was opened by GithHub Actions. Whenever you're ready to publish the packages, merge this PR." | ||
description="$(printf "%s\n # Packages\n%s" "$pr_message" "$packages_published")" | ||
gh pr create --base main --head ${{ github.event.inputs.branch }} --title "Publish" --body "$description" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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