Skip to content

Commit

Permalink
ci: teardown stack after pr (#1)
Browse files Browse the repository at this point in the history
* ci: teardown stack after pr

* refactor: try to check service_url

* refactor: check serverless info

* refactor: sls info

* refactor: pass stage to sls info

* refactor: add back mask to service url
  • Loading branch information
bernardobridge authored Jan 23, 2024
1 parent 2543594 commit c23a9ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,15 @@ jobs:
- name: Run functional tests
run: echo "Running functional tests against ${{ needs.deploy-ephemeral.outputs.SERVICE_URL }}"
env:
SERVICE_URL: ${{ needs.deploy-ephemeral.outputs.SERVICE_URL }}
SERVICE_URL: ${{ needs.deploy-ephemeral.outputs.SERVICE_URL }}

teardown-ephemeral-env:
uses: ./.github/workflows/stack-delete.yaml
needs: run-functional-tests
permissions:
id-token: write
contents: read
secrets:
AWS_DEPLOYER_ROLE: ${{ secrets.AWS_DEPLOYER_ROLE }}
with:
ENVIRONMENT: ${{ github.actor }}-${{ github.event.pull_request.number }}
6 changes: 4 additions & 2 deletions .github/workflows/serverless-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ jobs:
- name: seed_db
if: ${{ inputs.SHOULD_SEED_DB == true }}
run: npm run seed-db
- name: Do serverless info
run: npx serverless info --stage ${{ inputs.ENVIRONMENT }} --verbose
- id: set_service_url
name: Generate, mask, and output a secret
run: |
SERVICE_URL="$(npx serverless info --verbose | grep ServiceEndpoint | sed s/ServiceEndpoint\:\ //g)"
# echo "::add-mask::$SERVICE_URL"
SERVICE_URL="$(npx serverless info --stage ${{ inputs.ENVIRONMENT }} --verbose | grep ServiceEndpoint | sed s/ServiceEndpoint\:\ //g)"
echo "::add-mask::$SERVICE_URL"
echo "SERVICE_URL=$SERVICE_URL" >> "$GITHUB_OUTPUT"

0 comments on commit c23a9ca

Please sign in to comment.