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 5a88b89..87b368c 100644 --- a/.github/workflows/deploy_production.yml +++ b/.github/workflows/deploy.yml @@ -1,11 +1,12 @@ -name: deploy_production +name: deploy on: release: - types: [released] + 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.yml deleted file mode 100644 index 097181e..0000000 --- a/.github/workflows/deploy_development.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: deploy_development -on: - release: - types: [prereleased] -env: - MAJORVERSION: '' - COMPONENT_NAME: ${{ github.event.repository.name }} - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: 'Checkout GitHub Action' - uses: actions/checkout@v4 - - name: 'Get Version' - id: get_version - uses: battila7/get-version-action@v2 - - name: 'Check for correct naming convention' - if: ${{ !steps.get_version.outputs.is-semver }} - run: | - echo "::error title=Bad version format::The version specified does not follow semantic versioning" - exit 1 - - name: Get version from tag - run: echo "VERSION=${{ steps.get_version.outputs.version-without-v }}" >> $GITHUB_ENV - - name: Check that the builder file exists - if: ${{ hashFiles(format('builder/versions/{0}.{1}.json', github.event.repository.name, steps.get_version.outputs.version-without-v)) == '' }} - run: | - echo "::error file=builder/versions,title=Missing builder file::The builder file for $VERSION is missing from builder/versions" - exit 1 - - name: Display version install - run: echo "Installing dev version ${VERSION}" - - - run: npm install - - run: npm rebuild - - run: npm run-script build - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ vars.TOOLKIT_AWS_ACCESS_KEY }} - aws-secret-access-key: ${{ secrets.TOOLKIT_AWS_ACCESS_SECRET }} - aws-region: us-east-2 - - 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 diff --git a/.github/workflows/deploy_development_manual.yml b/.github/workflows/deploy_development_manual.yml new file mode 100644 index 0000000..77e74ba --- /dev/null +++ b/.github/workflows/deploy_development_manual.yml @@ -0,0 +1,37 @@ +name: deploy_development_manual +on: + workflow_dispatch: + inputs: + version: + description: 'Version number' + required: true + default: '' + type: string +env: + COMPONENT_NAME: ${{ github.event.repository.name }} +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@v4 + - name: Get version from input + run: echo "VERSION=${GITHUB_BRANCH}" >> $GITHUB_ENV + env: + GITHUB_BRANCH: ${{ github.event.inputs.version }} + - name: Display version install + run: echo "Installing dev version ${VERSION} for component ${COMPONENT_NAME}" + + - run: npm install + - run: npm rebuild + - run: npm run-script build + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ vars.TOOLKIT_AWS_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.TOOLKIT_AWS_ACCESS_SECRET }} + aws-region: us-east-2 + - 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*" 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 e733ff4..964f0d0 100644 --- a/.github/workflows/publish_npm.yml +++ b/.github/workflows/publish_npm.yml @@ -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}} \ No newline at end of file diff --git a/builder/ilw-call-to-action.json b/builder/ilw-call-to-action.json index 44e1265..d47eadf 100644 --- a/builder/ilw-call-to-action.json +++ b/builder/ilw-call-to-action.json @@ -7,5 +7,5 @@ "description": "Call to action component to prompt visitors to perform an action or a few related actions.", "toolkit-version": "", "production-version": "", - "development-version": "1.0.0-alpha2" + "development-version": "1.0-beta" } \ No newline at end of file diff --git a/builder/versions/ilw-call-to-action.1.0.0-alpha2.json b/builder/versions/ilw-call-to-action.1.0-beta.json similarity index 97% rename from builder/versions/ilw-call-to-action.1.0.0-alpha2.json rename to builder/versions/ilw-call-to-action.1.0-beta.json index 9cb8529..794c55b 100644 --- a/builder/versions/ilw-call-to-action.1.0.0-alpha2.json +++ b/builder/versions/ilw-call-to-action.1.0-beta.json @@ -5,10 +5,11 @@ "type": "web component", "element-name": "ilw-call-to-action", "description": "Call to action component to prompt visitors to perform an action or a few related actions.", - "version": "1.0.0-alpha2", + "builder-version": "1.0-beta", + "version": "1.0.0-beta", "date": "08/21/2024", - "css": "https://dev.toolkit.illinois.edu/ilw-call-to-action/1.0.0-alpha2/ilw-call-to-action.css", - "js": "https://dev.toolkit.illinois.edu/ilw-call-to-action/1.0.0-alpha2/ilw-call-to-action.js", + "css": "https://dev.toolkit.illinois.edu/ilw-call-to-action/1.0.0-beta/ilw-call-to-action.css", + "js": "https://dev.toolkit.illinois.edu/ilw-call-to-action/1.0.0-beta/ilw-call-to-action.js", "production": false, "notes": "", "parent-style": "", diff --git a/package-lock.json b/package-lock.json index 01dee34..1c6cd30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@illinois-toolkit/ilw-call-to-action", - "version": "0.0.1", + "version": "1.0.0-beta", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@illinois-toolkit/ilw-call-to-action", - "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 403ba74..ef1625d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "repository": "github:web-illinois/ilw-call-to-action", "private": false, "license": "MIT", - "version": "1.0.0-alpha2", + "version": "1.0.0-beta", "type": "module", "files": [ "src/**",