diff --git a/.github/workflows/release-step-2.yml b/.github/workflows/release-step-2.yml deleted file mode 100644 index 748ae89e..00000000 --- a/.github/workflows/release-step-2.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: "Release - Step 2: Publish SDK Release to Release Order Branch" - -on: - workflow_dispatch: - inputs: - dryRun: - description: 'Do a dry run to preview instead of a real release [true/false]' - required: true - type: boolean - default: true - versionNumber: - description: 'Which SDK version to publish? [X.XX.XX]' - required: true - type: string - releaseOrderBranch: - description: 'Which Release Order Branch are you targeting? [release-order-a/release-order-b/release-order-c]' - required: true - type: choice - options: - - release-order-a - - release-order-b - - release-order-c - -jobs: - verify-version-number: - name: Verify SDK Version (${{ github.event.inputs.versionNumber}}) - runs-on: ubuntu-latest - steps: - # As a safe guard, if a valid version number does not exist, - # this step will fail and throw an error - - name: Checkout SDK Version (${{ github.event.inputs.versionNumber}}) - uses: actions/checkout@v3 - with: - ref: release/${{ github.event.inputs.versionNumber}} - - verify-release-order-branch: - name: Verify Release Order Branch - runs-on: ubuntu-latest - steps: - # As a safe guard, if a valid release branch does not exist, - # this step will fail and throw an error - - name: Checkout Release Order (${{ github.event.inputs.releaseOrderBranch }}) - uses: actions/checkout@v3 - with: - ref: ${{ github.event.inputs.releaseOrderBranch }} - - push-release-branch: - name: Deploy v${{ github.event.inputs.versionNumber}} to ${{ github.event.inputs.releaseOrderBranch}} - needs: - - verify-version-number - - verify-release-order-branch - runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} - GIT_AUTHOR_NAME: mparticle-automation - GIT_AUTHOR_EMAIL: developers@mparticle.com - GIT_COMMITTER_NAME: mparticle-automation - GIT_COMMITTER_EMAIL: developers@mparticle.com - - steps: - - name: Checkout master branch - uses: actions/checkout@v3 - with: - fetch-depth: 0 - repository: ${{ github.repository }} - token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} - ref: release/${{ github.event.inputs.versionNumber}} - - - name: Push v${{ github.event.inputs.versionNumber}} to ${{ github.event.inputs.releaseOrderBranch }} - if: ${{ github.event.inputs.dryRun == false }} - run: | - git push origin HEAD:${{ github.event.inputs.releaseOrderBranch }} \ No newline at end of file diff --git a/.github/workflows/release-step-3.yml b/.github/workflows/release-step-3.yml deleted file mode 100644 index f083964c..00000000 --- a/.github/workflows/release-step-3.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: "Release - Step 3: Release to CDN and Synchronize Branches" - -on: - workflow_dispatch: - inputs: - versionNumber: - description: 'Which SDK version to synchronize? [X.XX.XX]' - required: true - type: string - -jobs: - verify-version-number: - name: Verify SDK Version (${{ github.event.inputs.versionNumber}}) - runs-on: ubuntu-latest - steps: - # As a safe guard, if a valid release branch does not exist, - # this step will fail and throw an error. - # Pushing previous versions of the SDK will require manual intervention. - # This action is not used for rollbacks. - - name: Checkout SDK Version (${{ github.event.inputs.versionNumber}}) - uses: actions/checkout@v3 - with: - ref: release/${{ github.event.inputs.versionNumber}} - - - synchronize-branches: - name: Synchronize SDK to all branches - runs-on: ubuntu-latest - needs: - - verify-version-number - env: - GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} - GIT_AUTHOR_NAME: mparticle-automation - GIT_AUTHOR_EMAIL: developers@mparticle.com - GIT_COMMITTER_NAME: mparticle-automation - GIT_COMMITTER_EMAIL: developers@mparticle.com - - steps: - - name: Checkout master branch - uses: actions/checkout@v3 - with: - fetch-depth: 0 - repository: ${{ github.repository }} - token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} - ref: master - - - name: Merge release branch into master branch - run: | - git pull origin release/${{ github.event.inputs.versionNumber}} - - - name: Push release commits to development - run: | - git push origin HEAD:development - - # We will eventually replace master with main - - name: Push release commits to main and master - run: | - git push origin HEAD:master - git push origin HEAD:main - - - name: Push release commits to Release Order Branches - run: | - git push origin HEAD:release-order-a - git push origin HEAD:release-order-b - git push origin HEAD:release-order-c \ No newline at end of file diff --git a/.github/workflows/release-step-1.yml b/.github/workflows/release.yml similarity index 86% rename from .github/workflows/release-step-1.yml rename to .github/workflows/release.yml index c9cd5c72..1e7200e2 100644 --- a/.github/workflows/release-step-1.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: "Release - Step 1: Prepare CDN Pre-Release, Publish NPM" +name: Release SDK on: workflow_dispatch: @@ -212,7 +212,7 @@ jobs: branch_name: ${{ vars.GITHUB_SHA }} build_command: npm run build:esm && npm run build:test-bundle - create-pre-release-branch: + create-release-branch: name: Create release branch runs-on: ubuntu-latest needs: @@ -234,14 +234,14 @@ jobs: - name: Create and push release branch run: | - git checkout -b pre-release/${{ github.run_number }} - git push origin pre-release/${{ github.run_number }} + git checkout release/${{ github.run_number }} + git push origin release/${{ github.run_number }} - pre-release: - name: Perform Pre-Release + release: + name: Perform Release runs-on: ubuntu-latest needs: - - create-pre-release-branch + - create-release-branch env: GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} GIT_AUTHOR_NAME: mparticle-automation @@ -265,7 +265,7 @@ jobs: git_user_signingkey: true git_commit_gpgsign: true - - name: Merge pre-release branch into local master branch + - name: Merge release branch into master branch run: | git pull origin pre-release/${{ github.run_number }} @@ -288,10 +288,6 @@ jobs: run: | npx semantic-release - - name: Get Package Version Number - uses: martinbeentjes/npm-get-version-action@3cf273023a0dda27efcd3164bdfb51908dd46a5b #v1.3.1 - id: packageJsonVersion - - name: Archive npm failure logs uses: actions/upload-artifact@v3 if: failure() @@ -299,12 +295,35 @@ jobs: name: npm-logs path: ~/.npm/_logs - - name: Push automated release commits to pre-release branch + - name: Push automated release commits to release branch if: ${{ github.event.inputs.dryRun == 'false' }} run: | - git push origin HEAD:release/${{ steps.packageJsonVersion.outputs.current-version }} + git push origin HEAD:release/${{ github.run_number }} - - name: Delete pre-release branch - if: ${{ github.event.inputs.dryRun == 'false' }} - run: | - git push --delete origin pre-release/${{ github.run_number }} \ No newline at end of file + sync-repository: + name: Sync repositories + needs: release + runs-on: ubuntu-latest + steps: + - name: Checkout master branch + uses: actions/checkout@v3 + with: + fetch-depth: 0 + repository: ${{ github.repository }} + token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} + ref: master + + - name: Merge release branch into master branch + if: ${{ github.event.inputs.dryRun == 'false' }} + run: | + git pull origin release/${{ github.run_number }} + - name: Push release commits to main, master and development branches + if: ${{ github.event.inputs.dryRun == 'false' }} + run: | + git push origin HEAD:development + git push origin HEAD:master + git push origin HEAD:main + - name: Delete release branch + if: ${{ github.event.inputs.dryRun == 'false' }} + run: | + git push --delete origin release/${{ github.run_number }} \ No newline at end of file