Skip to content

adding docker build to actions #5

adding docker build to actions

adding docker build to actions #5

Workflow file for this run

name: Main
on:
push:
branches:
- main
- jeremymv2/allow_any_job_image
permissions:
contents: write
jobs:
detect_changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
bump_app: ${{ steps.filter.outputs.bump_app }}
bump_helm: ${{ steps.filter.outputs.bump_helm }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
bump_app:
- 'cmd/**'
bump_helm:
- 'helm/**'
bump_build_push:
needs: detect_changes
if: needs.detect_changes.outputs.bump_app == 'true' || needs.detect_changes.outputs.bump_helm == 'true'
name: Bump Version(s)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Bump Application version in package.json
if: needs.detect_changes.outputs.bump_app == 'true'
id: app-version-bump
uses: 'phips28/gh-action-bump-version@master'
with:
major-wording: 'major,breaking'
minor-wording: 'feat,minor'
patch-wording: 'fix,chore,test,docs,style,refactor,patch'
# defaulting to a patch bump.
rc-wording: 'RELEASE,alpha'
skip-commit: 'true'
skip-tag: 'true'
skip-push: 'true'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
PACKAGEJSON_DIR: 'cmd'
- name: New Version Output
env:
NEW_TAG: ${{ steps.app-version-bump.outputs.newTag }}
run: echo "New version $NEW_TAG"
- name: Retrieve Docker Image Name with Tag
run: |
echo "IMG_TAG_NAME=$(make docker_img_name_with_tag)" >> $GITHUB_OUTPUT
id: img_name_and_version_tag
- name: New Image Name with Tag
env:
IMG_TAG_NAME: ${{ steps.img_name_and_version_tag.outputs.IMG_TAG_NAME }}
run: |
echo "New Image Name with Tag: $IMG_TAG_NAME"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ${{ steps.img_name_and_version_tag.outputs.IMG_TAG_NAME }}