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

ENH: Add version and compose check to workflow #50

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
43 changes: 33 additions & 10 deletions .github/workflows/cloud_chatops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,41 @@ jobs:
context: "{{defaultContext}}:cloud-chatops"
tags: "harbor.stfc.ac.uk/stfc-cloud-staging/cloud-chatops:${{ steps.commit_sha.outputs.sha_short }}"


check_version_update:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v4
with:
ref: 'master'
path: 'main'

- name: Checkout current working branch
uses: actions/checkout@v4
with:
path: 'branch'

- name: Compare versions
if: ${{ github.ref != 'refs/heads/master' }}
uses: khalford/check-version-action@main
khalford marked this conversation as resolved.
Show resolved Hide resolved
with:
app_version_path: "cloud-chatops/version.txt"
docker_compose_path: "cloud-chatops/docker-compose.yaml"

- name: Log App Success
if: ${{ env.app_updated == 'true' }}
run: |
echo "App version has been updated correctly!"

- name: Log Compose Success
if: ${{ env.compose_updated == 'true' }}
run: |
echo "Compose version has been updated correctly!"

push_prod_image_harbor:
runs-on: ubuntu-latest
needs: test_and_lint
needs: [test_and_lint, check_version_update]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
Expand All @@ -101,17 +133,8 @@ jobs:
id: release_tag
run: echo "version=$(cat cloud-chatops/version.txt)" >> $GITHUB_OUTPUT

- name: Check if release file has updated
uses: dorny/paths-filter@v2
id: release_updated
with:
filters: |
version:
- 'cloud-chatops/version.txt'

- name: Build and push on version change
uses: docker/build-push-action@v6
if: steps.release_updated.outputs.version == 'true'
with:
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
2 changes: 1 addition & 1 deletion cloud-chatops/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
cloud_chatops:
image: harbor.stfc.ac.uk/stfc-cloud/cloud-chatops
image: harbor.stfc.ac.uk/stfc-cloud/cloud-chatops:1.0.5
volumes:
- $HOME/cloud_chatops_secrets/:/usr/src/app/cloud_chatops_secrets/
watchtower:
Expand Down
2 changes: 1 addition & 1 deletion cloud-chatops/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.4
1.0.5
Loading