generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add build and publish workflow (#1102)
*** need to merge [sbl-project pr](cfpb/sbl-project#331) prior to mergeing this one *** - adding workflow for build and publish images to GHCR - updated current pattern to include new workflow
- Loading branch information
1 parent
806d72d
commit fd85f68
Showing
4 changed files
with
151 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: BuildImage | ||
|
||
on: | ||
workflow_call: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout GitHub Action' | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
# not tagging with version yet, adding this in the event we start versioning | ||
- name: Get Version | ||
id: version | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
echo "TAG_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV | ||
- name: 'Build Release Image' | ||
id: buildrelease | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/sbl-frontend:latest -f Dockerfile . | ||
- name: 'Build Test Image' | ||
id: buildtest | ||
if: github.ref != 'refs/heads/main' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/sbl-frontend:pr_test_${{ github.event.number }} -f Dockerfile . | ||
- name: 'Login to GitHub Container Registry' | ||
id: login | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: 'Publish Image' | ||
id: publish | ||
if: steps.login.conclusion == 'success' | ||
run: | | ||
docker push ghcr.io/cfpb/regtech/sbl/sbl-frontend --all-tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters