Shadows #63
Workflow file for this run
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: Deploy Latest tag | |
on: | |
release: | |
types: [published, created, edited] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
EC2-deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: prod | |
url: ${{ steps.deploy.outputs.vm_url }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get Latest Release Tag | |
id: latest_tag | |
run: | | |
LATEST_TAG=$(curl --silent -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name') | |
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT | |
- name: Ensure `dist` Folder Exists | |
run: | | |
if [ ! -d "public/dist" ]; then | |
echo "Dist folder not found. Aborting deployment." | |
echo "Did you release from staging?" | |
exit 1 | |
fi | |
- name: Create repo_env file | |
run: | | |
echo "CLIENT_COMMIT_SHA=${{ github.sha }}" > repo_env | |
echo "CLIENT_JIRA_APP_KEY=bitovi.status-report" >> repo_env | |
echo "repo_env file created with CLIENT_COMMIT_SHA=${{ github.sha }} at $(pwd)" | |
- name: Create Jira Connect | |
run: | | |
npm i | |
npm run create:atlassian-connect | |
- name: Cleanup for Deploy | |
run: rm -rf node_modules | |
- id: deploy | |
name: Deploy Prod | |
if: ${{ github.ref_name == steps.latest_tag.outputs.latest_tag }} | |
uses: bitovi/[email protected] | |
with: | |
checkout: false | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_JIRA_INTEGRATIONS}} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_JIRA_INTEGRATIONS}} | |
aws_default_region: us-east-1 | |
aws_resource_identifier: bitovi-jira-status-reports-prod | |
tf_state_bucket_destroy: true | |
tf_state_bucket: bitovi-jira-status-reports-prod-tf-state | |
aws_r53_enable: true | |
aws_r53_sub_domain_name: status-reports | |
aws_r53_domain_name: bitovi.tools | |
aws_r53_create_sub_cert: true | |
aws_elb_app_port: 3000 | |
docker_full_cleanup: true | |
aws_ec2_instance_type: t3.small | |
aws_ec2_instance_root_vol_size: 30 | |
env_repo: repo_env | |
env_ghs: ${{ secrets.DOT_ENV }} | |
- name: Skip deployment | |
if: ${{ github.ref_name != steps.latest_tag.outputs.latest_tag }} | |
run: echo "This is not the latest tag. Deployment skipped." |