create the table #84
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 Environment | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
aws_account_id: ${{ vars.AWS_ACCOUNT_ID }} | |
aws_region: ${{ vars.AWS_REGION }} | |
aws_role: ${{ vars.AWS_ROLE }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
dynamodb-local: | |
image: "amazon/dynamodb-local:latest" | |
ports: | |
- "8000:8000" | |
options: --health-cmd="curl -s -o /dev/null -I -w "%{http_code}" http://localhost:8000 | grep -q 400 || exit 1" --health-interval=1s --health-timeout=2s --health-retries=10 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: create table | |
run: | | |
dynamodb create-table --endpoint-url http://dynamodb-local:8000 --region $DYNAMODB_AWS_REGION --table-name $DYNAMODB_TABLE --billing-mode PAY_PER_REQUEST --key-schema AttributeName=id,KeyType=HASH --attribute-definitions AttributeName=id,AttributeType=S AttributeName=title,AttributeType=S --global-secondary-indexes "IndexName=IpIndex,KeySchema=[{AttributeName=title,KeyType=HASH}],Projection={ProjectionType=ALL}" | |
echo lols | |
- name: list table | |
run: | | |
aws dynamodb list-tables --region local --endpoint-url http://localhost:8000 | |
# - name: create db | |
# run: | | |
# aws dynamodb create-table --table-name stateful_aws_api_tasks --region local --endpoint-url http://localhost:8000 --billing-mode PAY_PER_REQUEST --key-schema AttributeName=id,KeyType=HASH --attribute-definitions AttributeName=id,AttributeType=S AttributeName=title,AttributeType=S --global-secondary-indexes "IndexName=IpIndex,KeySchema=[{AttributeName=title,KeyType=HASH}],Projection={ProjectionType=ALL}" | |
# - name: check | |
# run: | | |
# aws dynamodb list-tables --region local --endpoint-url http://localhost:8000 | |
# - name: build app | |
# run: | | |
# docker build . -t ci:app | |
# - name: run app | |
# run: | | |
# docker run -d -p 9000:9000 --network host --env-file ${GITHUB_WORKSPACE}/.env ci:app | |
# - name: test | |
# run: | | |
# curl -s -o /dev/null -I -w "%{http_code}" http://localhost:9000/hello 2>/dev/null | |
# docker logs ci:app | |
# # BASE_URL=http://localhost:9000 npm run ci:test | |
# deploy: | |
# needs: test | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: checkout | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 | |
# - uses: extractions/setup-just@v2 | |
# - uses: aws-actions/configure-aws-credentials@v4 | |
# with: | |
# aws-region: ${{ env.aws_region }} | |
# role-to-assume: arn:aws:iam::${{ env.aws_account_id }}:role/${{ env.aws_role }} | |
# role-session-name: GitHubActions | |
# - name: build | |
# shell: bash | |
# run: just build | |
# - name: tf-apply | |
# shell: bash | |
# run: just tf-apply | |
# - name: tf-set-envs | |
# shell: bash | |
# run: | | |
# cd tf | |
# URL=$(terraform output -raw url) | |
# echo "URL=$URL" | |
# echo "URL=$URL" >> $GITHUB_ENV | |
# clean: | |
# if: always() | |
# needs: | |
# - deploy | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: checkout | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 | |
# - uses: extractions/setup-just@v2 | |
# - uses: aws-actions/configure-aws-credentials@v4 | |
# with: | |
# aws-region: ${{ env.aws_region }} | |
# role-to-assume: arn:aws:iam::${{ env.aws_account_id }}:role/${{ env.aws_role }} | |
# role-session-name: GitHubActions | |
# - name: destroy | |
# shell: bash | |
# run: just destroy |