Generate tags and Deploy #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate tags and Deploy | |
on: | |
workflow_dispatch | |
jobs: | |
release-tags: | |
name: Generate Release Tags | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
with: | |
ref: v2 | |
- name: Get the latest version | |
id: get_version | |
run: echo "::set-output name=version::$(node -p "require('./package.json').version")" | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v${{ steps.get_version.outputs.version }} | |
release_name: v${{ steps.get_version.outputs.version }} | |
body: | | |
Release v${{ steps.get_version.outputs.version }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
name: Deploy to AWS S3 | |
runs-on: ubuntu-latest | |
env: | |
AWS_S3_BUCKET: tarka-public-libraries | |
AWS_REGION: ap-south-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
with: | |
ref: v2 | |
- name: Get the latest version | |
id: get_version | |
run: echo "::set-output name=version::$(node -p "require('./package.json').version")" | |
- name: Rename build files | |
run: | | |
current_version=$(echo "${{ steps.get_version.outputs.version }}") | |
mv dist/tarka-chat.es.js "dist/tarka-chat-${current_version}.es.js" | |
mv dist/tarka-chat.umd.js "dist/tarka-chat-${current_version}.umd.js" | |
- name: Push the files to S3 bucket | |
uses: jakejarvis/s3-sync-action@master | |
env: | |
SOURCE_DIR: 'dist' | |
AWS_S3_BUCKET: ${{ env.AWS_S3_BUCKET }} | |
AWS_REGION: ${{ env.AWS_REGION }} | |
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} |