From f11023accb85e912743c8c13ea3d5346401a79e5 Mon Sep 17 00:00:00 2001 From: Bryan Jonker Date: Fri, 13 Sep 2024 14:52:13 -0500 Subject: [PATCH 1/2] prepping for beta --- .../{deploy_production.yml => deploy.yml} | 45 +++++++++++++++---- ...ment.yml => deploy_development_manual.yml} | 7 ++- .../workflows/deploy_production_manual.yml | 5 +-- .github/workflows/publish_npm.yml | 8 ++-- .github/workflows/templating.yml | 31 ------------- ...0.0-alpha1.json => ilw-icon.1.0-beta.json} | 7 +-- package-lock.json | 4 +- package.json | 2 +- 8 files changed, 52 insertions(+), 57 deletions(-) rename .github/workflows/{deploy_production.yml => deploy.yml} (55%) rename .github/workflows/{deploy_development.yml => deploy_development_manual.yml} (90%) delete mode 100644 .github/workflows/templating.yml rename builder/versions/{ilw-icon.1.0.0-alpha1.json => ilw-icon.1.0-beta.json} (87%) diff --git a/.github/workflows/deploy_production.yml b/.github/workflows/deploy.yml similarity index 55% rename from .github/workflows/deploy_production.yml rename to .github/workflows/deploy.yml index 167dd2b..87b368c 100644 --- a/.github/workflows/deploy_production.yml +++ b/.github/workflows/deploy.yml @@ -1,11 +1,12 @@ -name: deploy_production +name: deploy on: - push: - tags: [ '**' ] + release: + types: [published] env: MAJORVERSION: '' MINORVERSION: '' FULLVERSION: '' + PRERELEASE: '' COMPONENT_NAME: ${{ github.event.repository.name }} jobs: build: @@ -15,7 +16,7 @@ jobs: uses: actions/checkout@v4 - name: 'Get Version' id: get_version - uses: battila7/get-version-action@v2 + uses: dhkatz/get-version-action@v3.0.0 - name: 'Check for correct naming convention' if: ${{ !steps.get_version.outputs.is-semver }} @@ -33,12 +34,22 @@ jobs: run: echo "FULLVERSION=${GITHUB_BRANCH}" >> $GITHUB_ENV env: GITHUB_BRANCH: ${{ steps.get_version.outputs.version-without-v }} + - name: Get prelease version from tag + run: echo "PRERELEASE=${GITHUB_BRANCH}" >> $GITHUB_ENV + env: + GITHUB_BRANCH: ${{ steps.get_version.outputs.prerelease }} - name: Display major version install - run: echo "Installing major version ${MAJORVERSION}" + run: echo "Installing major version ${MAJORVERSION} for ${COMPONENT_NAME}" - name: Display minor version install - run: echo "Installing minor version ${MINORVERSION}" + run: echo "Installing minor version ${MINORVERSION} for ${COMPONENT_NAME}" - name: Display patch (full) version install - run: echo "Installing patch (full) version ${FULLVERSION}" + run: echo "Installing patch (full) version ${FULLVERSION} for ${COMPONENT_NAME}" + - name: Production run + if: ${{ steps.get_version.outputs.prerelease == '' }} + run: echo "Running production deployment" + - name: Prerelease run + if: ${{ steps.get_version.outputs.prerelease != '' }} + run: echo "Running development deployment" - run: npm install - run: npm rebuild @@ -51,14 +62,32 @@ jobs: aws-region: us-east-2 - name: Deploy toolbox to S3 bucket for major version + if: ${{ steps.get_version.outputs.prerelease == '' }} run: aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$MAJORVERSION --delete --acl bucket-owner-full-control - name: Invalidate Cloudfront cache for major version + if: ${{ steps.get_version.outputs.prerelease == '' }} run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$MAJORVERSION*" - name: Deploy toolbox to S3 bucket for minor version + if: ${{ steps.get_version.outputs.prerelease == '' }} run: aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$MINORVERSION --delete --acl bucket-owner-full-control - name: Invalidate Cloudfront cache for minor version + if: ${{ steps.get_version.outputs.prerelease == '' }} run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$MINORVERSION*" - name: Deploy toolbox to S3 bucket for patch (full) version + if: ${{ steps.get_version.outputs.prerelease == '' }} run: aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$FULLVERSION --delete --acl bucket-owner-full-control - name: Invalidate Cloudfront cache for patch (full) version - run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$FULLVERSION*" \ No newline at end of file + if: ${{ steps.get_version.outputs.prerelease == '' }} + run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$FULLVERSION*" + - name: Deploy toolbox to S3 bucket for full version dev + if: ${{ steps.get_version.outputs.prerelease != '' }} + run: aws s3 sync ./dist/ s3://dev.toolkit.illinois.edu/content/$COMPONENT_NAME/$FULLVERSION --delete --acl bucket-owner-full-control + - name: Invalidate Cloudfront cache for full version dev + if: ${{ steps.get_version.outputs.prerelease != '' }} + run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT_DEV }} --paths "/$COMPONENT_NAME/$FULLVERSION*" + - name: Deploy toolbox to S3 bucket for latest dev + if: ${{ steps.get_version.outputs.prerelease != '' }} + run: aws s3 sync ./dist/ s3://dev.toolkit.illinois.edu/content/$COMPONENT_NAME/latest --delete --acl bucket-owner-full-control + - name: Invalidate Cloudfront cache for latest dev + if: ${{ steps.get_version.outputs.prerelease != '' }} + run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT_DEV }} --paths "/$COMPONENT_NAME/latest*" diff --git a/.github/workflows/deploy_development.yml b/.github/workflows/deploy_development_manual.yml similarity index 90% rename from .github/workflows/deploy_development.yml rename to .github/workflows/deploy_development_manual.yml index 00660b9..77e74ba 100644 --- a/.github/workflows/deploy_development.yml +++ b/.github/workflows/deploy_development_manual.yml @@ -1,4 +1,4 @@ -name: deploy_development +name: deploy_development_manual on: workflow_dispatch: inputs: @@ -8,7 +8,6 @@ on: default: '' type: string env: - MAJORVERSION: '' COMPONENT_NAME: ${{ github.event.repository.name }} jobs: build: @@ -21,7 +20,7 @@ jobs: env: GITHUB_BRANCH: ${{ github.event.inputs.version }} - name: Display version install - run: echo "Installing dev version ${VERSION}" + run: echo "Installing dev version ${VERSION} for component ${COMPONENT_NAME}" - run: npm install - run: npm rebuild @@ -35,4 +34,4 @@ jobs: - name: Deploy toolbox to S3 bucket run: aws s3 sync ./dist/ s3://dev.toolkit.illinois.edu/content/$COMPONENT_NAME/$VERSION --delete --acl bucket-owner-full-control - name: Invalidate Cloudfront cache - run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT_DEV }} --paths "/$COMPONENT_NAME/$VERSION*" \ No newline at end of file + run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT_DEV }} --paths "/$COMPONENT_NAME/$VERSION*" diff --git a/.github/workflows/deploy_production_manual.yml b/.github/workflows/deploy_production_manual.yml index 252cdca..d2eb320 100644 --- a/.github/workflows/deploy_production_manual.yml +++ b/.github/workflows/deploy_production_manual.yml @@ -8,9 +8,6 @@ on: default: '' type: string env: - MAJORVERSION: '' - MINORVERSION: '' - FULLVERSION: '' COMPONENT_NAME: ${{ github.event.repository.name }} jobs: build: @@ -23,7 +20,7 @@ jobs: env: GITHUB_BRANCH: ${{ github.event.inputs.version }} - name: Display version install - run: echo "Installing production version ${VERSION}" + run: echo "Installing production version ${VERSION} for component ${COMPONENT_NAME}" - run: npm install - run: npm rebuild diff --git a/.github/workflows/publish_npm.yml b/.github/workflows/publish_npm.yml index 70d0cdf..964f0d0 100644 --- a/.github/workflows/publish_npm.yml +++ b/.github/workflows/publish_npm.yml @@ -1,8 +1,8 @@ name: publish_npm on: workflow_dispatch: - push: - tags: [ '**' ] + release: + types: [published] jobs: build: runs-on: ubuntu-latest @@ -15,7 +15,7 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm ci - - name: Publish to npm + - name: Install to npm run: npm publish --access public env: - NODE_AUTH_TOKEN: ${{secrets.TOOLKIT_NPM_SECRET}} + NODE_AUTH_TOKEN: ${{secrets.TOOLKIT_NPM_SECRET}} \ No newline at end of file diff --git a/.github/workflows/templating.yml b/.github/workflows/templating.yml deleted file mode 100644 index d3dd39c..0000000 --- a/.github/workflows/templating.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Apply caz templating - -on: [push] - -jobs: - run-caz: - # Avoid running more than once - if: ${{ github.repository != 'web-illinois/toolkit-template' && github.repository != 'marvel-uiuc/template-ilw' && github.run_number == 1 }} - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} - - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Apply caz template - run: npx -y caz ./ output --name ${{ github.event.repository.name }} --repository ${{ github.repository }} - - name: Commit template changes - run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - rm -rf template index.js .gitignore package-lock.json README.md - cp -rT output . - rm -rf output - git add -A - git commit -a -m "chore: init template" - git push --force \ No newline at end of file diff --git a/builder/versions/ilw-icon.1.0.0-alpha1.json b/builder/versions/ilw-icon.1.0-beta.json similarity index 87% rename from builder/versions/ilw-icon.1.0.0-alpha1.json rename to builder/versions/ilw-icon.1.0-beta.json index f016c94..c2f1fca 100644 --- a/builder/versions/ilw-icon.1.0.0-alpha1.json +++ b/builder/versions/ilw-icon.1.0-beta.json @@ -5,10 +5,11 @@ "type": "web component", "element-name": "ilw-icon", "description": "A wrapper class to pull the icons from https://cdn.brand.illinois.edu/icons.html", - "version": "1.0.0-alpha1", + "builder-version": "1.0-beta", + "version": "1.0.0-beta", "date": "09/03/2024", - "css": "https://dev.toolkit.illinois.edu/ilw-icon/1.0.0-alpha1/ilw-icon.css", - "js": "https://dev.toolkit.illinois.edu/ilw-icon/1.0.0-alpha1/ilw-icon.js", + "css": "https://dev.toolkit.illinois.edu/ilw-icon/1.0.0-beta/ilw-icon.css", + "js": "https://dev.toolkit.illinois.edu/ilw-icon/1.0.0-beta/ilw-icon.js", "production": false, "notes": "", "parent-style": "", diff --git a/package-lock.json b/package-lock.json index 1decd32..2c89c60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@illinois-toolkit/ilw-icon", - "version": "0.0.1", + "version": "1.0.0-beta", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@illinois-toolkit/ilw-icon", - "version": "0.0.1", + "version": "1.0.0-beta", "license": "MIT", "dependencies": { "lit": "3.1.3" diff --git a/package.json b/package.json index cbed446..29d5735 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "repository": "github:bryanjonker-illinois/ilw-icon", "private": false, "license": "MIT", - "version": "1.0.0-alpha1", + "version": "1.0.0-beta", "type": "module", "files": [ "src/**", From 9c649273e86aebcd7c74e57b347db567951bfdbe Mon Sep 17 00:00:00 2001 From: Bryan Jonker Date: Fri, 13 Sep 2024 14:52:59 -0500 Subject: [PATCH 2/2] date fix --- builder/versions/ilw-icon.1.0-beta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/versions/ilw-icon.1.0-beta.json b/builder/versions/ilw-icon.1.0-beta.json index c2f1fca..093a88f 100644 --- a/builder/versions/ilw-icon.1.0-beta.json +++ b/builder/versions/ilw-icon.1.0-beta.json @@ -7,7 +7,7 @@ "description": "A wrapper class to pull the icons from https://cdn.brand.illinois.edu/icons.html", "builder-version": "1.0-beta", "version": "1.0.0-beta", - "date": "09/03/2024", + "date": "09/13/2024", "css": "https://dev.toolkit.illinois.edu/ilw-icon/1.0.0-beta/ilw-icon.css", "js": "https://dev.toolkit.illinois.edu/ilw-icon/1.0.0-beta/ilw-icon.js", "production": false,