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

chore(ci): standardise workflows #873

Merged
merged 1 commit into from
Dec 12, 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
16 changes: 6 additions & 10 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
type: boolean

env:
DRY_RUN_ARG: ${{ inputs.dryRun && '--dry-run' || '' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

jobs:
Expand Down Expand Up @@ -58,21 +58,19 @@ jobs:
run: pnpm build
- name: Create Release and Tags
shell: bash
run: pnpm turbo-version -b ${{inputs.preReleaseVersion}}
run: pnpm turbo-version -b ${{ inputs.preReleaseVersion }}
- name: Publish to NPM
shell: bash
run: pnpx tsx scripts/publish.ts --tag next ${{inputs.dryRun && '--dry-run' || ''}}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpx tsx scripts/publish.ts --tag next ${{ inputs.dryRun && '--dry-run' || '' }}
- name: Log git changes
if: ${{inputs.dryRun}}
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}}
if: ${{ !inputs.dryRun }}
run: |
echo "Git log:"
git log --oneline -n 5
Expand All @@ -84,8 +82,6 @@ jobs:
git push --tags --no-verify && git push --no-verify
# pass the release tag to the next step
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
Expand All @@ -94,4 +90,4 @@ jobs:
prerelease: true
repository: webdriverio-community/wdio-electron-service
tag_name: ${{ steps.push-tags.outputs.RELEASE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
token: $GITHUB_TOKEN
35 changes: 17 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ on:
type: boolean

env:
DRY_RUN_ARG: ${{ inputs.dryRun && '--dry-run' || '' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
HUSKY: '0'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
ref: 'main'
fetch-depth: 0
- uses: actions/setup-node@v4
Expand All @@ -47,37 +47,36 @@ jobs:
run: |
git config --global user.email "[email protected]"
git config --global user.name "WebdriverIO Release Bot"
- name: Pushing to the protected branch 'main'
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.DEPLOY_PAT }}
branch: main
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Create Release and Tags
shell: bash
run: pnpm turbo-version -b ${{inputs.releaseVersion}}
run: pnpm turbo-version -b ${{ inputs.releaseVersion }}
- name: Publish to NPM
shell: bash
run: pnpx tsx scripts/publish.ts --tag latest ${{inputs.dryRun && '--dry-run' || ''}}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpx tsx scripts/publish.ts --tag latest ${{ inputs.dryRun && '--dry-run' || '' }}
- name: Log git changes
if: ${{inputs.dryRun}}
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}}
if: ${{ !inputs.dryRun }}
run: |
git push --tags && git push
echo "RELEASE_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
echo "Git log:"
git log --oneline -n 5
# get release tag
RELEASE_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "Release tag: $RELEASE_TAG"
echo "Pushing tags and commits..."
# push tags and commits without running the pre-push hook
git push --tags --no-verify && git push --no-verify
# pass the release tag to the next step
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
Expand All @@ -86,4 +85,4 @@ jobs:
prerelease: false
repository: goosewobbler/zutron
tag_name: ${{ steps.push-tags.outputs.RELEASE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
token: $GITHUB_TOKEN
Loading