Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add dryRun #65

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ on:
description: 'Prerelease Identifier. Used for NPM tag and version string. Defaults to "next", e.g. "1.0.0-next.0".'
required: true
default: 'next'
dryRun:
description: 'Do not touch or write anything. Show the commands.'
required: true
default: false
type: boolean

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down Expand Up @@ -54,22 +59,28 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Update Turbo Version config
uses: restackio/[email protected]
with:
file: version.config.json
fields: '{"prereleaseIdentifier": "${{inputs.prereleaseIdentifier}}"}'
# - name: Update Turbo Version config
# uses: restackio/[email protected]
# with:
# file: version.config.json
# fields: '{"prereleaseIdentifier": "${{inputs.prereleaseIdentifier}}"}'
- name: Create Release and Tags
shell: bash
run: pnpm turbo-version -b ${{inputs.prereleaseVersion}}
- name: Publish to NPM
shell: bash
run: pnpm publish -r --tag ${{inputs.prereleaseIdentifier}}
run: pnpm publish -r --tag ${{inputs.prereleaseIdentifier}} ${{inputs.dryRun && '--dry-run' || ''}}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Log git changes
if: ${{inputs.dryRun}}
run: |
git diff ..origin/main
echo "DRY RUN: No changes were made."
- name: Push Tags and Commits
id: push-tags
shell: bash
if: ${{!inputs.dryRun}}
run: |
git push --tags && git push
echo "RELEASE_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ on:
- patch
- minor
- major
npmTag:
description: 'NPM tag. Defaults to "latest".'
dryRun:
description: 'Do not touch or write anything. Show the commands.'
required: true
default: 'latest'
default: false
type: boolean

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down Expand Up @@ -58,12 +59,18 @@ jobs:
run: pnpm turbo-version -b ${{inputs.releaseVersion}}
- name: Publish to NPM
shell: bash
run: pnpm publish -r --tag ${{inputs.npmTag}}
run: pnpm publish -r --tag latest ${{inputs.dryRun && '--dry-run' || ''}}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Log git changes
if: ${{inputs.dryRun}}
run: |
git diff ..origin/main
echo "DRY RUN: No changes were made."
- name: Push Tags and Commits
id: push-tags
shell: bash
if: ${{!inputs.dryRun}}
run: |
git push --tags && git push
echo "RELEASE_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion version.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"zutron-e2e"
],
"prereleaseIdentifier": "next"
}
}