Skip to content

Commit

Permalink
manually setting build tags (bcgov#1283)
Browse files Browse the repository at this point in the history
* manually setting build tags

trying to manually set the version tags.. to fix the openshift issue where it's trying pull the wrong image based on the sha

* Update action.yaml

replaced github.sha with git rev-parse HEAD to keep things consistent

* Delete on-push.yaml

removing on-push in case of conflicts
  • Loading branch information
jasonchung1871 authored Feb 14, 2024
1 parent cb51400 commit 913cbf1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 121 deletions.
28 changes: 22 additions & 6 deletions .github/actions/build-push-container/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ inputs:
description: The checkout ref id
required: false
default: ''
pr_number:
description: Pull request number
required: false
type: string

runs:
using: composite
Expand All @@ -73,6 +77,18 @@ runs:
uses: actions/checkout@v3
if: ${{ inputs.ref == '' }}

- name: Set variables
run: |
echo "SHA=sha-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "IMAGE_REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "IMAGE_VERSION=main" >> $GITHUB_ENV
if [[ "${{ inputs.ref }}" != '' ]]; then
git fetch origin ${{ inputs.ref }}
echo "SHA=sha-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "IMAGE_REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "IMAGE_VERSION=pr-${{ inputs.pr_number }}" >> $GITHUB_ENV
fi
- name: Creates env variables
env:
VITE_TITLE: ${{ inputs.app_title }}
Expand Down Expand Up @@ -132,12 +148,12 @@ runs:
latest=true
# Creates tags based off of branch names and semver tags
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=ghcr.io/${{ env.GH_USERNAME }}/${{ inputs.image_name }}:${{ env.IMAGE_VERSION }}
type=raw,value=ghcr.io/${{ env.GH_USERNAME }}/${{ inputs.image_name }}:${{ env.SHA }}
type=raw,value=ghcr.io/${{ env.GH_USERNAME }}/${{ inputs.image_name }}:latest
labels: |
org.opencontainers.image.revision=${{ env.IMAGE_REVISION }}
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
- name: Build and Push to Container Registry
id: builder
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/.deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ jobs:
route_path: ${{ needs.set-vars.outputs.ROUTE_PATH }}
app_contact: ${{ vars.CHEFS_CONTACT }}
ref: ${{ needs.set-vars.outputs.ref }}
pr_number: ${{ github.event.inputs.pr-number }}

deploy:
name: Deploys to selected environment
Expand Down
115 changes: 0 additions & 115 deletions .github/workflows/on-push.yaml

This file was deleted.

0 comments on commit 913cbf1

Please sign in to comment.