Skip to content

Commit

Permalink
Chore: implement the workflow to publish beta release for core-bundle (
Browse files Browse the repository at this point in the history
…#5603)

* chore: implement workflow to publish beta release

* chore: fix the typo for LWC e2e tests

* chore: apply reviewer's suggestion

* chore: refactor publish beta workflow

* Update .github/workflows/approveAndPublishBeta.yml

Co-authored-by: Cristina Cañizales <113132642+CristiCanizales@users.noreply.github.com>

---------

Co-authored-by: Cristina Cañizales <113132642+CristiCanizales@users.noreply.github.com>
  • Loading branch information
mingxuanzhangsfdx and CristiCanizales committed May 21, 2024
1 parent 2fd7fc4 commit 6586c4f
Show file tree
Hide file tree
Showing 13 changed files with 247 additions and 4 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/approveAndPublishBeta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Approve and Publish Beta Release Branch
on:
workflow_run:
workflows:
- Create and Test Beta Release Branch
types:
- completed
workflow_dispatch:
inputs:
runId:
description: 'Run ID of the workflow run that created the vsixes'
required: true
type: string

jobs:
confirm_publish:
environment: publish
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} # Only run this if the previous workflow was successful
name: 'Confirm Publish Beta Release'
steps:
- run: echo "Please confirm to publish the beta release"
publish_beta:
needs: confirm_publish
uses: ./.github/workflows/publishBeta.yml
secrets: inherit
with:
runId: ${{ inputs.runId || github.event.workflow_run.id }}
63 changes: 63 additions & 0 deletions .github/workflows/createAndTestBetaReleaseBranch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Create and Test Beta Release Branch

on:
workflow_dispatch:

jobs:
create_branch:
name: 'Create Branch'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
branch: ${{ steps.branch.outputs.branch }}
result: ${{ steps.result.outputs.result }}
env:
RELEASE_TYPE: 'beta'

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'main'
ssh-strict: false
token: ${{ secrets.IDEE_GH_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- uses: ./.github/actions/gitConfig
with:
email: ${{ secrets.IDEE_GH_EMAIL }}
- name: Retrieve Scripts
run: |
git clone https://github.com/forcedotcom/bundle-publish-scripts.git
- name: Update references for Publishing
run: |
node bundle-publish-scripts/scripts/update-references-in-vsce.js
node bundle-publish-scripts/scripts/update-bundle-configs-in-vsce.js
- name: Set NPM at the correct version for Lerna
run: npm install -g npm@9.8.1
- run: npm install
- run: npm install -g shelljs && npm install -g lerna@5.5.4
- run: rm -rf ./bundle-publish-scripts
- name: Create and Push the Release Branch
id: create_step
run: |
echo "Creating a beta release from branch main"
node scripts/create-release-branch.js
- id: result
run: echo "result=${{ job.status }}" >> $GITHUB_OUTPUT
- id: version
run: echo "version="$(node -pe "require('./packages/salesforcedx-vscode/package.json').version")"" >> $GITHUB_OUTPUT
- id: branch
run: echo "branch=release/v${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT

run_build_and_test:
if: ${{ needs.create_branch.result == 'success' }} # Only run this if the previous job is successful
uses: ./.github/workflows/buildAndTest.yml
name: 'Run Build and Unit Test'
needs: create_branch
secrets: inherit
with:
branch: ${{needs.create_branch.outputs.branch}}
label: ${{needs.create_branch.outputs.version}}
3 changes: 2 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
workflows:
- Nightly Build Develop
- Test, Build, and Release
- Create and Test Beta Release Branch
types:
- completed

Expand Down Expand Up @@ -87,7 +88,7 @@ jobs:
runId: ${{ inputs.runId || github.event.workflow_run.id }}

LWC_E2E_tests:
if: ${{ inputs.lwcE2ETests || github.event_name == 'workflow_run' }}
if: ${{ inputs.lwcE2ETests || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
uses: ./.github/workflows/lwcE2E.yml
secrets: inherit
with:
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/publishBeta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Publish Beta to Github Only

on:
workflow_call:
inputs:
runId:
description: 'Run ID of the workflow run that created the vsixes'
required: false
type: string

jobs:
download_artifacts:
name: 'Checkout Version'
runs-on: ubuntu-latest
outputs:
RELEASE_VERSION: ${{ steps.getVersion.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
- name: Download extension vsixes
run: |
mkdir ./tmp-dir
gh run download ${{ inputs.runId }} -D ./tmp-dir
env:
GITHUB_TOKEN: ${{ secrets.IDEE_GH_TOKEN }}
- name: 'Confirm all downloaded files'
run: ls -R
working-directory: tmp-dir
- id: getVersion
run: |
version=$(basename "$(find ./tmp-dir -mindepth 1 -maxdepth 1 -type d)")
echo "::set-output name=version::$version"
create_git_tag:
name: 'Create and Tag Beta Release'
runs-on: ubuntu-latest
needs: download_artifacts
env:
VERSION: ${{ needs.download_artifacts.outputs.RELEASE_VERSION }}
EXTENSION_PATH: ./tmp-dir/${{ needs.download_artifacts.outputs.RELEASE_VERSION }}

steps:
- uses: actions/checkout@v3
with:
ref: release/v${{ env.VERSION }}
- name: Download extension vsixes
run: |
mkdir ./tmp-dir
gh run download ${{ inputs.runId }} -D ./tmp-dir
env:
GITHUB_TOKEN: ${{ secrets.IDEE_GH_TOKEN }}
- run: cp ./packages/salesforcedx-vscode/CHANGELOG.md ${{ env.EXTENSION_PATH }}
- uses: ./.github/actions/gitConfig
with:
email: ${{ secrets.IDEE_GH_EMAIL }}
- name: 'Create git tag to map to the Release Version'
run: |
git tag v${{ env.VERSION }}
git push origin v${{ env.VERSION }}
- name: 'Confirm all downloaded files'
run: ls -R
working-directory: ${{ env.EXTENSION_PATH }}
- name: 'Create Pre-Release and Attach VSIX Files'
run: gh release create v${{ env.VERSION }} **.vsix --title "Pre-Release v${{ env.VERSION }}" --notes-file CHANGELOG.md --prerelease
working-directory: ${{ env.EXTENSION_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/salesforcedx-vscode-apex-debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"cross-env": "5.2.0",
"esbuild": "^0.19.5",
"eslint": "8.52.0",
"esbuild-plugin-pino": "^2.1.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.29.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"chai": "^4.0.2",
"cross-env": "5.2.0",
"esbuild": "^0.19.5",
"esbuild-plugin-pino": "^2.1.0",
"eslint": "8.52.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-header": "3.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/salesforcedx-vscode-apex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"chai": "^4.0.2",
"cross-env": "5.2.0",
"esbuild": "^0.19.5",
"esbuild-plugin-pino": "^2.1.0",
"eslint": "8.52.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-header": "3.1.1",
Expand Down Expand Up @@ -105,7 +106,6 @@
"@salesforce/apex-tmlanguage": "1.4.0",
"@salesforce/core": "7.3.1",
"@salesforce/source-tracking": "6.0.4",
"@salesforce/templates": "^60.1.2",
"applicationinsights": "1.0.7",
"shelljs": "0.8.5"
},
Expand Down
1 change: 1 addition & 0 deletions packages/salesforcedx-vscode-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"chai": "^4.0.2",
"cross-env": "5.2.0",
"esbuild": "^0.19.5",
"esbuild-plugin-pino": "^2.1.0",
"eslint": "8.52.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-header": "3.1.1",
Expand Down
1 change: 1 addition & 0 deletions packages/salesforcedx-vscode-lightning/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"chai": "^4.0.2",
"cross-env": "5.2.0",
"esbuild": "^0.19.5",
"esbuild-plugin-pino": "^2.1.0",
"eslint": "8.52.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-header": "3.1.1",
Expand Down
Loading

0 comments on commit 6586c4f

Please sign in to comment.