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

fix: Use workflow call to trigger image build during release #254

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ on:
push:
branches:
- main # This will get tagged with `latest` and `v{{DATE}}-{{COMMIT_HASH_SHORT}}`
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
workflow_call:
inputs:
tag:
description: 'Additional tag for built images'
required: false
type: string
default: ""
pull_request_target:
types: [ opened, edited, synchronize, reopened, ready_for_review ]

Expand All @@ -25,8 +29,8 @@ jobs:
- name: Get the latest tag
id: get_tag
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
if [[ "${{ inputs.tag }}" != "" ]]; then
nesmabadr marked this conversation as resolved.
Show resolved Hide resolved
echo "tag=${{ inputs.tag }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "push" ]]; then
echo "tag=latest" >> $GITHUB_OUTPUT
fi
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,10 @@ jobs:
run: |
RELEASE_ID=$(./scripts/release/draft_release.sh ${{ github.event.inputs.name }})
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
- name: Create lightweight tag
- name: Create tag
run: |
git tag ${{ github.event.inputs.name }}
git push origin ${{ github.event.inputs.name }} --tags
- name: Wait for the Docker image
timeout-minutes: 20
env:
ITERATIONS: 40
SLEEP_SECONDS: 30
run: ./scripts/release/wait_for_image.sh ${{ env.IMAGE_REPO }}:${{ github.event.inputs.name }} $ITERATIONS $SLEEP_SECONDS
- name: Create release assets
id: create-assets
env:
Expand All @@ -68,7 +62,11 @@ jobs:
run: ./scripts/release/upload_assets.sh
outputs:
release_id: ${{ steps.draft-release.outputs.release_id }}

builds:
needs: draft-release
uses: ./.github/workflows/build-image.yml
with:
tag: "${{ github.event.inputs.name }}"
publish-release:
name: Publish release
needs: [validate-head-status, draft-release]
Expand All @@ -78,6 +76,12 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Wait for the Docker image
timeout-minutes: 20
env:
ITERATIONS: 40
SLEEP_SECONDS: 30
run: ./scripts/release/wait_for_image.sh ${{ env.IMAGE_REPO }}:${{ github.event.inputs.name }} $ITERATIONS $SLEEP_SECONDS
- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading