Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ssuman2-infoblox committed Nov 4, 2023
1 parent 53a3ff5 commit cc6e7fb
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ on:
branches:
- master
- release-*
branches-ignore:
- ib-release-*
pull_request: {}
workflow_dispatch: {}
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. v0.1.0)'
required: false

env:
# Common versions
GO_VERSION: '1.18'
GOLANGCI_VERSION: 'v1.47.1'
DOCKER_BUILDX_VERSION: 'v0.8.2'

# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run
# a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
DOCKER_USR: ${{ github.actor }}

jobs:
Expand Down Expand Up @@ -302,12 +304,22 @@ jobs:
- name: Vendor Dependencies
run: make vendor vendor.check

- name: Build Artifacts
- name: Build Artifacts with Version
run: make -j2 build.all VERSION=${XPKG_VERSION}
if: env.XPKG_VERSION != ''
env:
# We're using docker buildx, which doesn't actually load the images it
# builds by default. Specifying --load does so.
BUILD_ARGS: "--load"
XPKG_VERSION: ${{ github.event.inputs.version }}

- name: Build Artifacts without Version
run: make -j2 build.all
env:
# We're using docker buildx, which doesn't actually load the images it
# builds by default. Specifying --load does so.
BUILD_ARGS: "--load"
XPKG_VERSION: ${{ github.event.inputs.version }}

- name: Publish Artifacts to GitHub
uses: actions/upload-artifact@v2
Expand All @@ -323,11 +335,19 @@ jobs:
username: ${{ secrets.DOCKER_USR }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Artifacts to GHCR
- name: Publish Artifacts to GHCR with Version
run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} VERSION=${XPKG_VERSION}
if: env.DOCKER_USR != '' && env.XPKG_VERSION != ''
env:
GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XPKG_VERSION: ${{ github.event.inputs.version }}

- name: Publish Artifacts to GHCR without Version
run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/}
if: env.DOCKER_USR != ''
if: env.DOCKER_USR != '' && env.XPKG_VERSION == ''
env:
GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XPKG_VERSION: ${{ github.event.inputs.version }}

- name: Promote Artifacts in Docker Hub
if: github.ref == 'refs/heads/master' && env.DOCKER_USR != ''
Expand Down

0 comments on commit cc6e7fb

Please sign in to comment.