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

Adding new workflows with make compile step. #473

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
31 changes: 0 additions & 31 deletions .github/workflows/build_prodrc_pr.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/build_test_pr.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Manual Build & Push
on:
workflow_dispatch:
jobs:
build-push:
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.event.repository.name }}-develop'
tags: br-${{ github.ref_name }}
secrets: inherit
39 changes: 39 additions & 0 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Pull Request Build, Tag, & Push
on:
pull_request:
branches:
- develop
- main
- master
types:
- opened
- reopened
- synchronize
- closed
jobs:
build-develop-open:
if: github.base_ref == 'develop' && github.event.pull_request.merged == false
uses: ./.github/workflows/reusable_build.yml
secrets: inherit
build-develop-merge:
if: github.base_ref == 'develop' && github.event.pull_request.merged == true
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.event.repository.name }}-develop'
tags: pr-${{ github.event.number }},latest
secrets: inherit
build-main-open:
if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == false
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.event.repository.name }}'
tags: pr-${{ github.event.number }}
secrets: inherit
build-main-merge:
if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == true
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.event.repository.name }}'
tags: pr-${{ github.event.number }},latest-rc
secrets: inherit
38 changes: 0 additions & 38 deletions .github/workflows/prod_release.yaml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Release - Build & Push Image
on:
release:
branches:
- main
- master
types: [ published ]
jobs:
check-source-branch:
uses: kbase/.github/.github/workflows/reusable_validate-branch.yml@main
with:
build_branch: '${{ github.event.release.target_commitish }}'
validate-release-tag:
needs: check-source-branch
uses: kbase/.github/.github/workflows/reusable_validate-release-tag.yml@main
with:
release_tag: '${{ github.event.release.tag_name }}'
build-push:
needs: validate-release-tag
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.event.repository.name }}'
tags: '${{ github.event.release.tag_name }},latest'
secrets: inherit
78 changes: 78 additions & 0 deletions .github/workflows/reusable_build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: Build & Push Image to GHCR
on:
workflow_call:
inputs:
name:
description: The image name
required: true
type: string
tags:
description: The image tags
required: true
type: string
jobs:
build-push-image:
runs-on: ubuntu-latest
container: jsfillman/kb-sdk
steps:
- name: Check out GitHub Repo
uses: actions/checkout@v2

- name: Get current date
id: date
run: echo "::set-output name=date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
# note that the calling workflow must set `secrets: inherit`
username: '${{ secrets.GHCR_USERNAME }}'
password: '${{ secrets.GHCR_TOKEN }}'

- name: Create github action tags from image tags
id: tags
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const tags = '${{ inputs.tags }}'.split(',');
const username = '${{ github.event.repository.owner.login }}';
const repoName = '${{ inputs.name }}';
return tags.map((tag) => {
return `ghcr.io/${username}/${repoName}:${tag}`;
}).join(',');

- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "kbase.yml, Makefile, *.spec"

- name: Run kb-sdk compile
if: steps.check_files.outputs.files_exists == 'true'
run: |
cd $GITHUB_WORKSPACE;
if [ -f kbase.yml ] && [ -f Makefile ] && [ -f *.spec ] ; then
make compile;
else
echo "Not a kb-sdk dependent app, skipping."
fi

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
pull: true
push: true
build-args: |
BUILD_DATE=${{ steps.date.outputs.date }}
VCS_REF=${{ github.sha }}
BRANCH='${{ github.ref }}'
TAG='${{ github.ref }}'
tags: '${{ steps.tags.outputs.result }}'
38 changes: 38 additions & 0 deletions .github/workflows/reusable_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Build Image without pushing
on:
workflow_call:
jobs:
build-image:
runs-on: ubuntu-latest
container: jsfillman/kb-sdk
steps:
- name: Check out GitHub Repo
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "kbase.yml, Makefile, *.spec"

- name: Run kb-sdk compile
if: steps.check_files.outputs.files_exists == 'true'
run: |
cd $GITHUB_WORKSPACE;
if [ -f kbase.yml ] && [ -f Makefile ] && [ -f *.spec ] ; then
make compile;
else
echo "Not a kb-sdk dependent app, skipping."
fi

- name: Build without push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
pull: true
push: false
17 changes: 0 additions & 17 deletions .github/workflows/scripts/build_prodrc_pr.sh

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/scripts/build_test_pr.sh

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/scripts/deploy_tag.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/scripts/prod_release.sh

This file was deleted.

Loading