From 2e02e859cc3f0361e84e160a6b00ea575c81aa2f Mon Sep 17 00:00:00 2001 From: Scott Sundahl Date: Sun, 29 Dec 2024 11:57:27 -0700 Subject: [PATCH] latest for major version --- .../workflows/publish-package-to-npmjs.yml | 75 ++++++++++--------- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/.github/workflows/publish-package-to-npmjs.yml b/.github/workflows/publish-package-to-npmjs.yml index b0ff88c..a84308f 100644 --- a/.github/workflows/publish-package-to-npmjs.yml +++ b/.github/workflows/publish-package-to-npmjs.yml @@ -26,6 +26,11 @@ on: description: Publish package to CDN (In general, always release to both) required: false default: true + release_latest_version: + type: number + description: Release a latest major version (*-[majorVersion]-latest.js) + required: false + default: false jobs: incrementVersionNumber: uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-increase-version-number.yaml@v2 @@ -56,25 +61,25 @@ jobs: run: npm install - name: Build script run: npm run build -- --mode=${{ matrix.target }} + # - uses: actions/upload-artifact@v4 + # if: inputs.publish_to_cdn + # with: + # name: uid2SDK-${{ matrix.target }}-${{ steps.version.outputs.package_version }} + # path: ./dist/uid2-sdk-${{ steps.version.outputs.package_version }}.js - uses: actions/upload-artifact@v4 - if: inputs.publish_to_cdn - with: - name: uid2SDK-${{ matrix.target }}-${{ steps.version.outputs.package_version }} - path: ./dist/uid2-sdk-${{ steps.version.outputs.package_version }}.js - - uses: actions/upload-artifact@v4 - if: inputs.publish_to_cdn + if: inputs.release_latest_version with: - name: uid2SDK-${{ matrix.target }}-latest + name: uid2SDK-${{ matrix.target }}-v${{inputs.release_latest_version}}-latest path: ./dist/uid2-sdk-latest.js + # - uses: actions/upload-artifact@v4 + # if: inputs.publish_to_cdn + # with: + # name: euidSDK-${{ matrix.target }}-${{ steps.version.outputs.package_version }} + # path: ./dist/euid-sdk-${{ steps.version.outputs.package_version }}.js - uses: actions/upload-artifact@v4 - if: inputs.publish_to_cdn - with: - name: euidSDK-${{ matrix.target }}-${{ steps.version.outputs.package_version }} - path: ./dist/euid-sdk-${{ steps.version.outputs.package_version }}.js - - uses: actions/upload-artifact@v4 - if: inputs.publish_to_cdn + if: inputs.release_latest_version with: - name: euidSDK-${{ matrix.target }}-latest + name: euidSDK-${{ matrix.target }}-v${{inputs.release_latest_version}}-latest path: ./dist/euid-sdk-latest.js outputs: sdkVersion: ${{ steps.version.outputs.package_version }} @@ -122,19 +127,20 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ needs.incrementVersionNumber.outputs.git_tag_or_hash }} + # - uses: ./.github/actions/cdn_deployment_aws + # with: + # environment: ${{ matrix.environment }} + # artifact: uid2SDK-${{ (matrix.environment == 'integ' && 'development') || matrix.environment }}-${{ needs.build.outputs.sdkVersion}} + # invalidate_paths: '/uid2-sdk-${{ needs.build.outputs.sdkVersion}}.js' + # aws_account_id: ${{ vars.AWS_ACCOUNT_ID }} + # aws_bucket_name: ${{ vars.S3_BUCKET }} + # aws_distribution_id: ${{ secrets.AWS_DISTRIBUTION_ID }} - uses: ./.github/actions/cdn_deployment_aws + if: inputs.release_latest_version with: environment: ${{ matrix.environment }} - artifact: uid2SDK-${{ (matrix.environment == 'integ' && 'development') || matrix.environment }}-${{ needs.build.outputs.sdkVersion}} - invalidate_paths: '/uid2-sdk-${{ needs.build.outputs.sdkVersion}}.js' - aws_account_id: ${{ vars.AWS_ACCOUNT_ID }} - aws_bucket_name: ${{ vars.S3_BUCKET }} - aws_distribution_id: ${{ secrets.AWS_DISTRIBUTION_ID }} - - uses: ./.github/actions/cdn_deployment_aws - with: - environment: ${{ matrix.environment }} - artifact: uid2SDK-${{ (matrix.environment == 'integ' && 'development') || matrix.environment }}-latest - invalidate_paths: '/uid2-sdk-latest.js' + artifact: uid2SDK-${{ (matrix.environment == 'integ' && 'development') || matrix.environment }}-v${{inputs.release_latest_version}}-latest + invalidate_paths: '/uid2-sdk-v${{inputs.release_latest_version}}-latest.js' aws_account_id: ${{ vars.AWS_ACCOUNT_ID }} aws_bucket_name: ${{ vars.S3_BUCKET }} aws_distribution_id: ${{ secrets.AWS_DISTRIBUTION_ID }} @@ -152,19 +158,20 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ needs.incrementVersionNumber.outputs.git_tag_or_hash }} + # - uses: ./.github/actions/cdn_deployment_aws + # with: + # environment: ${{ matrix.environment }} + # artifact: euidSDK-${{ (matrix.environment == 'integ' && 'development') || matrix.environment }}-${{ needs.build.outputs.sdkVersion}} + # invalidate_paths: '/euid-sdk-${{ needs.build.outputs.sdkVersion}}.js' + # aws_account_id: ${{ vars.EUID_AWS_ACCOUNT_ID }} + # aws_bucket_name: ${{ vars.EUID_S3_BUCKET }} + # aws_distribution_id: ${{ secrets.EUID_AWS_DISTRIBUTION_ID }} - uses: ./.github/actions/cdn_deployment_aws + if: inputs.release_latest_version with: environment: ${{ matrix.environment }} - artifact: euidSDK-${{ (matrix.environment == 'integ' && 'development') || matrix.environment }}-${{ needs.build.outputs.sdkVersion}} - invalidate_paths: '/euid-sdk-${{ needs.build.outputs.sdkVersion}}.js' - aws_account_id: ${{ vars.EUID_AWS_ACCOUNT_ID }} - aws_bucket_name: ${{ vars.EUID_S3_BUCKET }} - aws_distribution_id: ${{ secrets.EUID_AWS_DISTRIBUTION_ID }} - - uses: ./.github/actions/cdn_deployment_aws - with: - environment: ${{ matrix.environment }} - artifact: euidSDK-${{ (matrix.environment == 'integ' && 'development') || matrix.environment }}-latest - invalidate_paths: '/euid-sdk-latest.js' + artifact: euidSDK-${{ (matrix.environment == 'integ' && 'development') || matrix.environment }}-v${{inputs.release_latest_version}}-latest + invalidate_paths: '/euid-sdk-v${{inputs.release_latest_version}}-latest.js' aws_account_id: ${{ vars.EUID_AWS_ACCOUNT_ID }} aws_bucket_name: ${{ vars.EUID_S3_BUCKET }} aws_distribution_id: ${{ secrets.EUID_AWS_DISTRIBUTION_ID }}