diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml new file mode 100644 index 00000000..a233ab9c --- /dev/null +++ b/.github/workflows/build-dev.yml @@ -0,0 +1,41 @@ +name: build-and-push-dev +on: + push: + branches: [main] + +permissions: + contents: read + id-token: write + +env: + AWS_REGION: ap-southeast-2 + IMAGE_REPO: 498096047392.dkr.ecr.ap-southeast-2.amazonaws.com/aai-backend + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + # Authenticate to AWS + - uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ECR_PUSH }} + aws-region: ${{ env.AWS_REGION }} + + - uses: aws-actions/amazon-ecr-login@v2 + + - name: Build & Push (dev only) + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64 + push: true + tags: ${{ env.IMAGE_REPO }}:dev + provenance: false + sbom: false + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml new file mode 100644 index 00000000..faa51ab9 --- /dev/null +++ b/.github/workflows/build-publish.yml @@ -0,0 +1,41 @@ +name: build-and-push-release +on: + release: + types: [published] + +permissions: + contents: read + id-token: write + +env: + AWS_REGION: ap-southeast-2 + IMAGE_REPO: 498096047392.dkr.ecr.ap-southeast-2.amazonaws.com/aai-backend + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + # Authenticate to AWS + - uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ECR_PUSH }} + aws-region: ${{ env.AWS_REGION }} + + - uses: aws-actions/amazon-ecr-login@v2 + + - name: Build & Push (release) + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64 + push: true + tags: ${{ env.IMAGE_REPO }}:${{ github.event.release.tag_name }} + provenance: false + sbom: false + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 00000000..324ff8a0 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,11 @@ +name: commitlint +on: + pull_request: +permissions: + contents: read +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: wagoid/commitlint-github-action@v6 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..8d30dcfe --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,28 @@ +name: release-please +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + with: + release-type: docker + token: ${{ secrets.GITHUB_TOKEN }} + changelog-types: | + [ + {"type":"feat","section":"Features","hidden":false}, + {"type":"fix","section":"Bug Fixes","hidden":false}, + {"type":"perf","section":"Performance","hidden":false}, + {"type":"refactor","section":"Refactoring","hidden":true}, + {"type":"docs","section":"Docs","hidden":true}, + {"type":"chore","section":"Chores","hidden":true}, + {"type":"test","section":"Tests","hidden":true} + ] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ebbca478..1e141a95 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,3 +11,8 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml + - repo: https://github.com/compilerla/conventional-pre-commit + rev: v3.2.0 + hooks: + - id: conventional-pre-commit + stages: [commit-msg] diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..6e8bf73a --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0