Skip to content

Commit

Permalink
latest for major version
Browse files Browse the repository at this point in the history
  • Loading branch information
ssundahlTTD committed Dec 29, 2024
1 parent 3647981 commit 2e02e85
Showing 1 changed file with 41 additions and 34 deletions.
75 changes: 41 additions & 34 deletions .github/workflows/publish-package-to-npmjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}

0 comments on commit 2e02e85

Please sign in to comment.