From 0e08520aee1c18b4a734b0f5cd6880a021bcb06b Mon Sep 17 00:00:00 2001 From: Mike Fugate Date: Wed, 21 Oct 2020 14:26:13 -0400 Subject: [PATCH] add github actions to create a release and deploy to dev environment --- .github/workflows/build-and-release.yaml | 54 ++++++++++++++++++++++++ .github/workflows/version.yaml | 20 --------- package-lock.json | 2 +- 3 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/build-and-release.yaml delete mode 100644 .github/workflows/version.yaml diff --git a/.github/workflows/build-and-release.yaml b/.github/workflows/build-and-release.yaml new file mode 100644 index 00000000..4a6bd1b4 --- /dev/null +++ b/.github/workflows/build-and-release.yaml @@ -0,0 +1,54 @@ +name: 'Build and Deploy' +on: + push: + branches: + - 'master' + paths-ignore: + - projects/server/** + - terraform/** +jobs: + bump-version: + name: 'Build and Deploy' + runs-on: ubuntu-latest + steps: + - uses: 'actions/checkout@v2' + with: + fetch-depth: 0 + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - uses: phips28/gh-action-bump-version@v8.0.7 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: npm ci + - run: npm run build:prod + - run: zip -r upgrade-client-v${{ steps.package-version.outputs.current-version}}.zip * + working-directory: dist/abtesting + - run: mv dist/abtesting/upgrade-client-v${{ steps.package-version.outputs.current-version}}.zip . + - name: Generate Release Changelog + uses: Bullrich/generate-release-changelog@2.0.1 + id: changelog + env: + REPO: ${{ github.repository }} + - name: Generate Slack Changelog + run: | + echo 'CHANGELOG<> $GITHUB_ENV + git log --color=never --pretty='tformat:%xe2%x80%xa2 `%h` %s (%an)' ${{github.event.before}}..HEAD >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + - uses: martinbeentjes/npm-get-version-action@v1.1.0 + id: package-version + - name: Create Release + uses: ncipollo/release-action@v1 + with: + artifacts: upgrade-client-v${{ steps.package-version.outputs.current-version}}.zip + tag: v${{ steps.package-version.outputs.current-version}} + name: Upgrade Client ${{ steps.package-version.outputs.current-version}} + body: ${{ steps.changelog.outputs.changelog }} + commit: master + token: ${{ secrets.GITHUB_TOKEN }} + - uses: koraykoska/s3-upload-github-action@0.1.3 + env: + S3_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + S3_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}} + S3_BUCKET: ${{ secrets.S3_BUCKET }} + FILE: dist/abtesting/ \ No newline at end of file diff --git a/.github/workflows/version.yaml b/.github/workflows/version.yaml deleted file mode 100644 index 23c4e59b..00000000 --- a/.github/workflows/version.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: 'Bump Version' - -on: - push: - branches: - - 'master' -jobs: - bump-version: - name: 'Bump Version on master' - runs-on: ubuntu-latest - steps: - - name: 'Checkout source code' - uses: 'actions/checkout@v2' - - name: 'GitHub Version Bumper' - uses: 'kaangokdemir/github-version-bumper@master' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_NAME: 'tanmayjain3' - GITHUB_EMAIL: 'tanmayjain53@gmail.com' - VERSION_FILE_NAME: 'package.json' diff --git a/package-lock.json b/package-lock.json index ea9f3a71..34738320 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ab-testing", - "version": "1.0.4", + "version": "1.0.5", "lockfileVersion": 1, "requires": true, "dependencies": {