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

add build and publish workflow #279

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
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-user-fi-management:latest -f Dockerfile .
docker tag ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:${{env.TAG_VERSION}}
docker tag ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:latest ghcr.io/cfpb/regtech/sbl/regtech-user-fi-management:${{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-user-fi-management --all-tags

Loading