chore: changelog minor change #23
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
name: Test, Build and Deploy Area Calculator in Development | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- development # Trigger on push to the development branch | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Run tests | |
run: make test | |
- name: Build application | |
run: make build | |
# Setup S2i and Build container image | |
- name: Install s2i | |
run: | | |
wget https://github.com/openshift/source-to-image/releases/download/v1.1.14/source-to-image-v1.1.14-874754de-linux-386.tar.gz | |
tar -xvf source-to-image-v1.1.14-874754de-linux-386.tar.gz | |
sudo mv s2i /usr/local/bin | |
- name: s2i-build | |
run: | | |
sudo s2i build . quay.io/rh-ee-kmemane/go-s2i-builder quay.io/rh-ee-kmemane/area-calculator-development | |
sudo docker images | |
# Push Image to Quay registry | |
- name: Push Application image to quay | |
run: | | |
sudo docker login quay.io -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" | |
sudo docker push quay.io/rh-ee-kmemane/area-calculator-development | |
# deploy application in ocp cluster | |
- name: Authenticate and set context | |
uses: redhat-actions/oc-login@v1 | |
env: | |
OPENSHIFT_USER: rh-ee-kmemane | |
OPENSHIFT_NAMESPACE: rh-ee-kmemane-dev | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | |
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | |
insecure_skip_tls_verify: true | |
namespace: ${{ env.OPENSHIFT_NAMESPACE }} | |
- name: Deploy application | |
run: | | |
if oc get svc -l app=area-calculator-dev --ignore-not-found; then | |
oc delete svc,deployment,route,imagestream --selector app=area-calculator-dev; | |
echo "deleted all resources with label app=area-calculator-dev"; | |
fi | |
oc new-app quay.io/rh-ee-kmemane/area-calculator-development --name=area-calculator-dev --labels=app=area-calculator-dev,env=dev | |
oc expose svc area-calculator-dev --labels=env=dev | |
oc get routes -l app=area-calculator-dev |