Skip to content

Commit

Permalink
build: publish beta package
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon committed Apr 18, 2024
1 parent 71eb82f commit eddaf90
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/on-main-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
secrets: inherit

prepare-release:
needs: build
needs: [build]
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
Expand All @@ -28,7 +28,7 @@ jobs:
release-type: node

release:
needs: prepare-release
needs: [prepare-release]
runs-on: ubuntu-latest
if: needs.prepare-release.outputs.release_created == 'true'
steps:
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
yarn test:e2e
perf:
needs: prepare-release
needs: [prepare-release]
runs-on: ubuntu-latest
if: needs.prepare-release.outputs.release_created != 'true'
steps:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,56 @@ jobs:
uses: ./.github/workflows/reusable-build.yml
secrets: inherit

publish-beta:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'

- name: Setup dependencies, cache and install
uses: ./.github/actions/install

- uses: jwalton/gh-find-current-pr@master
id: pr-number

- name: Set beta channel value
run: |
echo "BETA_CHANNEL=beta-${{ steps.pr-number.outputs.pr }}" >> "$GITHUB_ENV"
- name: Setup Vals
run: |
git config --global user.email "[email protected]"
git config --global user.name "$BETA_CHANNEL"
- name: Publish $BETA_CHANNEL channel
run: |
CURRENT_VERSION=$(cat package.json | jq -r '.version')
BETA_TAG=$BETA_CHANNEL-${{ github.run_id }}-${{github.run_attempt}}
npm version "$CURRENT_VERSION-$BETA_TAG"
yarn npm publish --access public --tag $BETA_CHANNEL
env:
YARN_NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Write a comment that will be deleted at the end of the job
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Published under this [`$BETA_CHANNEL`](https://www.npmjs.com/package/sfdx-git-delta/v/$BETA_CHANNEL) channel.
To install it:
```sh
$ sfdx plugins:install sfdx-git-delta@$BETA_CHANNEL
```
Happy QA!
comment_tag: beta-publish
mode: recreate

e2e-check:
needs: [build]
strategy:
Expand Down

0 comments on commit eddaf90

Please sign in to comment.