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

Feature/63 build and publish images #64

Merged
merged 28 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bea9b0c
initial image build and publish workflow
thetoolsmith Dec 27, 2024
1988724
add version get and build with that
thetoolsmith Dec 27, 2024
a79c65d
fix line wrap
thetoolsmith Dec 27, 2024
15e622c
change triggers
thetoolsmith Dec 27, 2024
5562ca8
change triggers
thetoolsmith Dec 27, 2024
688a7de
fix tag name
thetoolsmith Dec 27, 2024
232907d
debug dynamic env var
thetoolsmith Dec 27, 2024
80f9d29
debug dynamic env var
thetoolsmith Dec 27, 2024
e259239
debug dynamic env var
thetoolsmith Dec 27, 2024
153ebd1
add dependency workflow run
thetoolsmith Jan 2, 2025
2afc4ad
change dependency
thetoolsmith Jan 2, 2025
58da62c
trying out some conditionals
thetoolsmith Jan 2, 2025
3ec707d
trying out some conditionals
thetoolsmith Jan 2, 2025
eaf545b
trying out some conditionals
thetoolsmith Jan 2, 2025
07593aa
trying out some conditionals
thetoolsmith Jan 2, 2025
5f64839
trying out some conditionals
thetoolsmith Jan 2, 2025
eff5c1e
trying out some conditionals
thetoolsmith Jan 2, 2025
c4cf07d
remove workflow dependency
thetoolsmith Jan 2, 2025
4b10862
test no trigger
thetoolsmith Jan 2, 2025
a0e4268
test break image, no trigger Coverage
thetoolsmith Jan 2, 2025
172457a
all workflows need to exist in default branch for workflow_run to work
thetoolsmith Jan 2, 2025
ca93d87
3 tags, latest, build, and semantic version
thetoolsmith Jan 2, 2025
985f9d5
move publish in same job as required
thetoolsmith Jan 2, 2025
6df3367
why is this trying to publish on a pr
thetoolsmith Jan 2, 2025
b7bad19
remove duplicate tag
thetoolsmith Jan 2, 2025
d11e910
make a unique image build number that is also persistent
thetoolsmith Jan 2, 2025
4f6b921
Merge branch 'main' into feature/63-build-and-publish-images
thetoolsmith Jan 6, 2025
efa8cf5
change image name to test GHA to GHCR
thetoolsmith Jan 8, 2025
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
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: BuildImage

on:
pull_request:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
id: checkout
uses: actions/checkout@v4

- name: Get Version
id: version
run: |
echo "TAG_VERSION=$(cat pyproject.toml | grep '^version.*$' | sed 's/version = //' | tr -d '\"' )" >> $GITHUB_ENV

- name: 'Build Image'
id: build
run: |
docker build -t ghcr.io/cfpb/regtech/sbl/regtech-mail-api-latest:latest -f Dockerfile .
docker tag ghcr.io/cfpb/regtech/sbl/regtech-mail-api-latest:latest ghcr.io/cfpb/regtech/sbl/regtech-mail-api:${{env.TAG_VERSION}}
docker tag ghcr.io/cfpb/regtech/sbl/regtech-mail-api-latest:latest ghcr.io/cfpb/regtech/sbl/regtech-mail-api:${{env.TAG_VERSION}}_${{github.run_number}}.${{github.run_attempt}}

- name: 'Login to GitHub Container Registry'
id: login
uses: docker/login-action@v3
if: github.ref == 'refs/heads/main' && steps.build.conclusion == 'success'
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: 'Publish Image'
id: publish
if: github.ref == 'refs/heads/main' && steps.login.conclusion == 'success'
run: |
docker push ghcr.io/cfpb/regtech/sbl/regtech-mail-api-latest --all-tags

2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
verbose: true
verbose: true
Loading