Skip to content

Commit

Permalink
Enhance GitHub Actions workflows to fetch latest release tags for bet…
Browse files Browse the repository at this point in the history
…a and production images. Updated cron schedule for production images and added ref input for Docker build and publish service.
  • Loading branch information
jaydrogers committed Jan 14, 2025
1 parent 72e1e4a commit c5d8db4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/action_publish-images-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@ on:
release:
types: [prereleased]
jobs:
get-latest-beta-release:
runs-on: ubuntu-24.04
outputs:
release_tag: ${{ steps.get_latest_beta.outputs.release_tag }}
steps:
- name: Get Latest Beta Release
id: get_latest_beta
run: |
LATEST_BETA=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases | jq -r '[.[] | select(.prerelease == true)][0].tag_name')
echo "release_tag=${LATEST_BETA}" >> $GITHUB_OUTPUT
build-beta-images:
uses: ./.github/workflows/service_docker-build-and-publish.yml
secrets: inherit
with:
release_type: 'beta'
ref: ${{ needs.get-latest-beta-release.outputs.release_tag }}
17 changes: 15 additions & 2 deletions .github/workflows/action_publish-images-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,24 @@ on:
release:
types: [released]
schedule:
- cron: '0 8 * * 2'
- cron: '0 4 * * 2'

jobs:
get-latest-release:
runs-on: ubuntu-24.04
outputs:
release_tag: ${{ steps.get_latest_release.outputs.release_tag }}
steps:
- name: Get Latest Release
id: get_latest_release
run: |
LATEST_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
echo "release_tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
build-production-images:
needs: get-latest-release
uses: ./.github/workflows/service_docker-build-and-publish.yml
secrets: inherit
with:
release_type: 'latest'
release_type: 'latest'
ref: ${{ needs.get-latest-release.outputs.release_tag }}
10 changes: 9 additions & 1 deletion .github/workflows/service_docker-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
required: true
description: 'Release type (latest, beta, edge, dev, etc)'
default: 'edge'
ref:
type: string
default: ${{ github.ref }}
description: 'The git ref to checkout (branch, tag, or commit SHA)'

jobs:
setup-matrix:
Expand All @@ -17,7 +21,9 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4

with:
ref: ${{ inputs.ref }}

- name: Assemble Ansible versions into the matrix 😎
id: get-ansible-versions
run: |
Expand All @@ -34,6 +40,8 @@ jobs:
steps:
- name: Check out code.
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Login to DockerHub
uses: docker/login-action@v3
Expand Down

0 comments on commit c5d8db4

Please sign in to comment.