1
+ name : deploy_production
2
+ on :
3
+ push :
4
+ tags : [ '**' ]
5
+ env :
6
+ MAJORVERSION : ' '
7
+ MINORVERSION : ' '
8
+ FULLVERSION : ' '
9
+ COMPONENT_NAME : ' ilw-video' # set this to the web component name you are using
10
+ jobs :
11
+ build :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - name : ' Checkout GitHub Action'
15
+ uses : actions/checkout@v4
16
+ - name : ' Get Version'
17
+ id : get_version
18
+ uses : battila7/get-version-action@v2
19
+
20
+ - name : ' Check for correct naming convention'
21
+ if : ${{ !steps.get_version.outputs.is-semver }}
22
+ run : exit 1
23
+ - name : ' Get major version from tag'
24
+ run : echo "MAJORVERSION=${GITHUB_BRANCH}" >> $GITHUB_ENV
25
+ env :
26
+ GITHUB_BRANCH : ${{ steps.get_version.outputs.major }}
27
+ - name : ' Get minor version from tag'
28
+ run : echo "MINORVERSION=${GITHUB_BRANCH}.${GITHUB_BRANCH_MINOR}" >> $GITHUB_ENV
29
+ env :
30
+ GITHUB_BRANCH : ${{ steps.get_version.outputs.major }}
31
+ GITHUB_BRANCH_MINOR : ${{ steps.get_version.outputs.minor }}
32
+ - name : Get patch (full) version from tag
33
+ run : echo "FULLVERSION=${GITHUB_BRANCH}" >> $GITHUB_ENV
34
+ env :
35
+ GITHUB_BRANCH : ${{ steps.get_version.outputs.version-without-v }}
36
+ - name : Display major version install
37
+ run : echo "Installing major version ${MAJORVERSION}"
38
+ - name : Display minor version install
39
+ run : echo "Installing minor version ${MINORVERSION}"
40
+ - name : Display patch (full) version install
41
+ run : echo "Installing patch (full) version ${FULLVERSION}"
42
+
43
+ - run : npm install
44
+ - run : npm rebuild
45
+ - run : npm run-script build
46
+ - name : Configure AWS Credentials
47
+ uses : aws-actions/configure-aws-credentials@v1
48
+ with :
49
+ aws-access-key-id : ${{ vars.TOOLKIT_AWS_ACCESS_KEY }}
50
+ aws-secret-access-key : ${{ secrets.TOOLKIT_AWS_ACCESS_SECRET }}
51
+ aws-region : us-east-2
52
+
53
+ - name : Deploy toolbox to S3 bucket for major version
54
+ run : aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$MAJORVERSION --delete --acl bucket-owner-full-control
55
+ - name : Invalidate Cloudfront cache for major version
56
+ run : aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$MAJORVERSION*"
57
+ - name : Deploy toolbox to S3 bucket for minor version
58
+ run : aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$MINORVERSION --delete --acl bucket-owner-full-control
59
+ - name : Invalidate Cloudfront cache for minor version
60
+ run : aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$MINORVERSION*"
61
+ - name : Deploy toolbox to S3 bucket for patch (full) version
62
+ run : aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$FULLVERSION --delete --acl bucket-owner-full-control
63
+ - name : Invalidate Cloudfront cache for patch (full) version
64
+ run : aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$FULLVERSION*"
0 commit comments