Skip to content

Commit

Permalink
Merge pull request #7 from aodn/features/cicd-prod-staging
Browse files Browse the repository at this point in the history
remove semantic release and add stuff for prod/staging
  • Loading branch information
vietnguyengit authored Dec 17, 2024
2 parents 14dc8f0 + 326d5d1 commit 6201109
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 138 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Release
on:
push:
tags:
- v*.*.*
permissions:
id-token: write
contents: read
jobs:
build_push:
runs-on: ubuntu-latest
environment: central
outputs:
digest: ${{ steps.build_and_push.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS Credentials
id: aws_auth
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ vars.ECR_REGISTRY }}
- name: Build and Push Docker Image
id: build_and_push
uses: docker/build-push-action@v5
with:
context: .
# Only building for AMD64 for now
# platforms: linux/amd64,linux/arm64
push: true
tags: ${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:${{ github.ref_name }}
- name: Generate App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.DEPLOY_APP_ID }}
private-key: ${{ secrets.DEPLOY_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Upload Docker Metadata to Release
run: |
json='${{ steps.build_and_push.outputs.metadata }}'
echo "$json" > metadata.json
gh release upload ${{ github.ref_name }} metadata.json
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
trigger_staging_deploy:
needs: [build_push]
uses: ./.github/workflows/trigger_deploy.yml
with:
app_name: data-access-service
environment: staging
digest: ${{ needs.build_push.outputs.digest }}
secrets: inherit
trigger_production_deploy:
needs: [build_push, trigger_staging_deploy]
uses: ./.github/workflows/trigger_deploy.yml
with:
app_name: data-access-service
environment: production
digest: ${{ needs.build_push.outputs.digest }}
secrets: inherit
100 changes: 0 additions & 100 deletions .github/workflows/semantic-release-ci.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test
on:
pull_request:
paths-ignore:
- '**/*.md'
- '.github/environment/**'
permissions:
id-token: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit-and-pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up Poetry
uses: snok/install-poetry@v1
with:
version: "latest"
- name: Install dependencies
run: |
poetry lock --no-update
poetry install
- name: Run pre-commit checks
run: |
poetry run pre-commit run --all-files
- name: Run tests
run: |
if [ -z "$(find . -name 'test_*.py')" ]; then echo "No tests found"; else poetry run pytest; fi
18 changes: 0 additions & 18 deletions .releaserc

This file was deleted.

12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,6 @@ The configurations for pre-commit hooks are defined in `.pre-commit-config.yaml`
pre-commit run --all-files
```
### Versioning
This project uses **semantic versioning** with automated releases managed by `semantic-release`.
Every code change with commits following [Conventional Commits](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) will trigger a version update and create a GitHub release.
**Commit Guidelines**
- `feat:` For new features
- `fix:` For bug fixes
- `BREAKING CHANGE:` For any breaking changes
## Environment variables
In the root directory of the project, create a `.env` file.
Expand Down
8 changes: 0 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,5 @@
"husky": "^8.0.0",
"prettier": "^3.3.3",
"prettier-plugin-sql": "^0.18.1"
},
"dependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/github": "^11.0.0",
"@semantic-release/release-notes-generator": "^14.0.1",
"semantic-release": "^24.2.0"
}
}

0 comments on commit 6201109

Please sign in to comment.