Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push environment images to GHCR #152

Merged
merged 2 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- dev
paths:
- '.aws/**'
- '.github/workflows/ecs-deploy-*.yml'
- '.github/workflows/deploy-*.yml'
- 'benefits/**'
- 'bin/**'
- Dockerfile
Expand Down Expand Up @@ -58,6 +58,13 @@ jobs:
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -73,6 +80,16 @@ jobs:
push: true
tags: ${{ steps.define-image-paths.outputs.client }}

- name: Build, tag, and push image to GitHub Container Registry
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha,scope=cal-itp
cache-to: type=gha,scope=cal-itp,mode=max
context: .
push: true
tags: ghcr.io/${{github.repository}}:dev

- name: Add environment-specific config to ECS task
env:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ jobs:
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -64,6 +71,16 @@ jobs:
push: true
tags: ${{ steps.define-image-paths.outputs.client }}

- name: Build, tag, and push image to GitHub Container Registry
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha,scope=cal-itp
cache-to: type=gha,scope=cal-itp,mode=max
context: .
push: true
tags: ghcr.io/${{github.repository}}:prod

- name: Add environment-specific config to ECS task
env:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ jobs:
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -64,6 +71,16 @@ jobs:
push: true
tags: ${{ steps.define-image-paths.outputs.client }}

- name: Build, tag, and push image to GitHub Container Registry
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha,scope=cal-itp
cache-to: type=gha,scope=cal-itp,mode=max
context: .
push: true
tags: ghcr.io/${{github.repository}}:test

- name: Add environment-specific config to ECS task
env:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: [opened]
paths:
- '.aws/**'
- '.github/workflows/ecs-deploy-*.yml'
- '.github/workflows/deploy-*.yml'
- 'benefits/**'
- 'bin/**'
- Dockerfile
Expand Down
12 changes: 6 additions & 6 deletions docs/deployment/workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

There are three different GitHub Actions deployment workflows, one for each environment:

* [`.github/workflows/ecs-deploy-dev.yml`][deploy-dev]
* [`.github/workflows/ecs-deploy-test.yml`][deploy-test]
* [`.github/workflows/ecs-deploy-prod.yml`][deploy-prod]
* [`.github/workflows/deploy-dev.yml`][deploy-dev]
* [`.github/workflows/deploy-test.yml`][deploy-test]
* [`.github/workflows/deploy-prod.yml`][deploy-prod]

!!! info

Expand Down Expand Up @@ -91,9 +91,9 @@ If in the future GitHub allows for templated workflows or branch-matrix support,
single file.


[deploy-dev]: https://github.com/cal-itp/benefits/blob/dev/.github/workflows/ecs-deploy-dev.yml
[deploy-test]: https://github.com/cal-itp/benefits/blob/dev/.github/workflows/ecs-deploy-test.yml
[deploy-prod]: https://github.com/cal-itp/benefits/blob/dev/.github/workflows/ecs-deploy-prod.yml
[deploy-dev]: https://github.com/cal-itp/benefits/blob/dev/.github/workflows/deploy-dev.yml
[deploy-test]: https://github.com/cal-itp/benefits/blob/dev/.github/workflows/deploy-test.yml
[deploy-prod]: https://github.com/cal-itp/benefits/blob/dev/.github/workflows/deploy-prod.yml
[dockerfile]: https://github.com/cal-itp/benefits/blob/dev/Dockerfile
[ecr]: https://aws.amazon.com/ecr/
[ecs-task-template]: https://github.com/cal-itp/benefits/blob/dev/.aws/ecs-task.json
Expand Down