Skip to content

Commit

Permalink
cambios
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMendozaPrado committed Apr 23, 2024
1 parent 57a986c commit 35a033d
Showing 1 changed file with 48 additions and 51 deletions.
99 changes: 48 additions & 51 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,56 +51,53 @@ jobs:
if: (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/WorkflowCI/CDsemanticversioning') && (github.event_name == 'push' || github.event_name == 'pull_request')

deploy-to-dev:
name: Deploy to Dev
runs-on: ubuntu-latest
needs: lint-and-test
if: (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/WorkflowCI/CDsemanticversioning') && github.event_name == 'push'

steps:
- uses: actions/checkout@v3
- name: Setup AWS Credentials
run: |
mkdir -p ~/.aws
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}" >> ~/.aws/credentials
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ~/.aws/credentials
- name: Deploy to AWS with SST
run: npm run deployStaging
- name: Clean up AWS profile
run: rm -rf ~/.aws
name: Deploy to Dev
runs-on: ubuntu-latest
needs: lint-and-test
if: (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/WorkflowCI/CDsemanticversioning') && github.event_name == 'push'
steps:
- uses: actions/checkout@v3
- name: Install SST
run: |
wget https://github.com/sst/ion/releases/download/v0.0.193/sst-linux-amd64.deb
sudo dpkg -i sst-linux-amd64.deb
sst version
- uses: oven-sh/setup-bun@v1
- name: Setup AWS Credentials
run: |
mkdir -p ~/.aws
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}" >> ~/.aws/credentials
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ~/.aws/credentials
- name: Deploy to AWS with SST
run: |
bun install
sst deploy --stage=dev --verbose
- name: Clean up AWS profile
run: rm -rf ~/.aws

deploy-to-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: lint-and-test
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Setup AWS Credentials
run: |
mkdir -p ~/.aws
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}" >> ~/.aws/credentials
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ~/.aws/credentials
- name: Deploy to AWS with SST
run: npm run deploy
- name: Clean up AWS profile
run: rm -rf ~/.aws
rollback:
name: Rollback to Previous Version
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.version }}
- name: Setup AWS Credentials
run: |
mkdir -p ~/.aws
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}" >> ~/.aws/credentials
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ~/.aws/credentials
- name: Deploy to AWS with SST (Rollback)
run: npm run deploy # mismo comando que para deploy-to-production
- name: Clean up AWS profile
run: rm -rf ~/.aws
name: Deploy to Production
runs-on: ubuntu-latest
needs: lint-and-test
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Install SST
run: |
wget https://github.com/sst/ion/releases/download/v0.0.193/sst-linux-amd64.deb
sudo dpkg -i sst-linux-amd64.deb
sst version
- uses: oven-sh/setup-bun@v1
- name: Setup AWS Credentials
run: |
mkdir -p ~/.aws
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}" >> ~/.aws/credentials
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ~/.aws/credentials
- name: Deploy to AWS with SST
run: |
bun install
sst deploy --stage=production --verbose
- name: Clean up AWS profile
run: rm -rf ~/.aws

0 comments on commit 35a033d

Please sign in to comment.