-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from silinternational/feature/github-actions
Convert to GitHub Actions
- Loading branch information
Showing
9 changed files
with
119 additions
and
63 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
# Whitelist required files | ||
!.env.encrypted | ||
!codeship/* | ||
!scripts/* | ||
!lambda/* | ||
!server/* | ||
!u2fsimulator/* | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Test, Deploy, Publish | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
tests: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_REGION: ${{ vars.AWS_REGION }} | ||
STG_AWS_ACCESS_KEY_ID: ${{ vars.STG_AWS_ACCESS_KEY_ID }} | ||
STG_AWS_SECRET_ACCESS_KEY: ${{ secrets.STG_AWS_SECRET_ACCESS_KEY }} | ||
PRD_AWS_ACCESS_KEY_ID: ${{ vars.PRD_AWS_ACCESS_KEY_ID }} | ||
PRD_AWS_SECRET_ACCESS_KEY: ${{ secrets.PRD_AWS_SECRET_ACCESS_KEY }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Test | ||
run: docker-compose -f actions-services.yml run --rm test ./scripts/test.sh | ||
|
||
deploy: | ||
name: Deploy to AWS Lambda | ||
needs: tests | ||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_REGION: ${{ vars.AWS_REGION }} | ||
STG_AWS_ACCESS_KEY_ID: ${{ vars.STG_AWS_ACCESS_KEY_ID }} | ||
STG_AWS_SECRET_ACCESS_KEY: ${{ secrets.STG_AWS_SECRET_ACCESS_KEY }} | ||
STG_LAMBDA_ROLE: ${{ vars.STG_LAMBDA_ROLE }} | ||
STG_API_KEY_TABLE: ${{ vars.STG_API_KEY_TABLE }} | ||
STG_WEBAUTHN_TABLE: ${{ vars.STG_WEBAUTHN_TABLE }} | ||
PRD_AWS_ACCESS_KEY_ID: ${{ vars.PRD_AWS_ACCESS_KEY_ID }} | ||
PRD_AWS_SECRET_ACCESS_KEY: ${{ secrets.PRD_AWS_SECRET_ACCESS_KEY }} | ||
PRD_LAMBDA_ROLE: ${{ vars.PRD_LAMBDA_ROLE }} | ||
PRD_API_KEY_TABLE: ${{ vars.PRD_API_KEY_TABLE }} | ||
PRD_WEBAUTHN_TABLE: ${{ vars.PRD_WEBAUTHN_TABLE }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Deploy | ||
run: docker-compose -f actions-services.yml run --rm app ./scripts/deploy.sh | ||
|
||
build-and-publish: | ||
name: Build and Publish | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ vars.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
version: "3" | ||
|
||
services: | ||
test: | ||
build: . | ||
environment: | ||
AWS_ENDPOINT: dynamo:8000 | ||
AWS_DISABLE_SSL: "true" | ||
API_KEY_TABLE: ApiKey | ||
WEBAUTHN_TABLE: WebAuthn | ||
LAMBDA_ROLE: placeholder | ||
AWS_REGION: $AWS_REGION | ||
GITHUB_REF_NAME: $GITHUB_REF_NAME | ||
STG_AWS_ACCESS_KEY_ID: $STG_AWS_ACCESS_KEY_ID | ||
STG_AWS_SECRET_ACCESS_KEY: $STG_AWS_SECRET_ACCESS_KEY | ||
PRD_AWS_ACCESS_KEY_ID: $PRD_AWS_ACCESS_KEY_ID | ||
PRD_AWS_SECRET_ACCESS_KEY: $PRD_AWS_SECRET_ACCESS_KEY | ||
depends_on: | ||
- dynamo | ||
|
||
app: | ||
build: . | ||
working_dir: /src | ||
environment: | ||
AWS_REGION: $AWS_REGION | ||
GITHUB_REF_NAME: $GITHUB_REF_NAME | ||
STG_AWS_ACCESS_KEY_ID: $STG_AWS_ACCESS_KEY_ID | ||
STG_AWS_SECRET_ACCESS_KEY: $STG_AWS_SECRET_ACCESS_KEY | ||
STG_LAMBDA_ROLE: $STG_LAMBDA_ROLE | ||
STG_API_KEY_TABLE: $STG_API_KEY_TABLE | ||
STG_WEBAUTHN_TABLE: $STG_WEBAUTHN_TABLE | ||
PRD_AWS_ACCESS_KEY_ID: $PRD_AWS_ACCESS_KEY_ID | ||
PRD_AWS_SECRET_ACCESS_KEY: $PRD_AWS_SECRET_ACCESS_KEY | ||
PRD_LAMBDA_ROLE: $PRD_LAMBDA_ROLE | ||
PRD_API_KEY_TABLE: $PRD_API_KEY_TABLE | ||
PRD_WEBAUTHN_TABLE: $PRD_WEBAUTHN_TABLE | ||
|
||
dynamo: | ||
image: amazon/dynamodb-local | ||
environment: | ||
AWS_ACCESS_KEY_ID: abc123 | ||
AWS_SECRET_ACCESS_KEY: abc123 | ||
AWS_DEFAULT_REGION: us-east-1 | ||
command: "-jar DynamoDBLocal.jar -sharedDb" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
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