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

feat(ci): add periodic build trigger #1459

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
10 changes: 10 additions & 0 deletions .github/workflows/publish-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,13 @@ jobs:
with:
downstream-version: ${{ needs.release-version.outputs.RELEASE_VERSION }}
secrets: inherit

publish-openapi-to-gh-pages:
name: "Publish OpenAPI UI spec GitHub Pages"
permissions:
contents: read
needs: [ release-version ]
uses: ./.github/workflows/publish-openapi-ui.yml
secrets: inherit
with:
version: ${{ needs.release-version.outputs.RELEASE_VERSION }}
40 changes: 37 additions & 3 deletions .github/workflows/publish-new-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ on:
- published
workflow_dispatch:

# periodic build triggers are defined in run-all-tests.yml, which triggers this workflow


concurrency:
# cancel only running jobs on pull requests
Expand All @@ -65,34 +67,66 @@ jobs:
[ ! -z "${{ secrets.SWAGGERHUB_USER }}" ] && echo "HAS_SWAGGER=true" >> $GITHUB_OUTPUT
exit 0

determine-version:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get-version.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- name: "Get version"
id: get-version
run: |

# only create the version string if the run-all-tests workflow was triggered by a cron event

if [[ ${{ github.event.workflow_run.event }} == "schedule" ]]; then
echo "VERSION=$(IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<$(grep "version" gradle.properties | awk -F= '{print $2}') && echo $RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$RELEASE_VERSION_PATCH-$(date +"%Y%m%d")-SNAPSHOT)" >> "$GITHUB_OUTPUT"
fi

publish-docker-images:
name: "Create Docker Images"
needs: [ secret-presence ]
needs: [ secret-presence, determine-version]
if: |
needs.secret-presence.outputs.DOCKER_HUB_TOKEN
permissions:
contents: write
uses: ./.github/workflows/trigger-docker-publish.yaml
secrets: inherit
with:
docker_tag: ${{ needs.determine-version.outputs.VERSION }}


publish-maven-artifacts:
name: "Publish artefacts to OSSRH Snapshots / MavenCentral"
permissions:
contents: read
needs: [ secret-presence ]
needs: [ secret-presence, determine-version ]

# do not run on PR branches, do not run on releases
if: |
needs.secret-presence.outputs.HAS_OSSRH && github.event_name != 'pull_request' && github.ref != 'refs/heads/releases'
uses: ./.github/workflows/trigger-maven-publish.yaml
secrets: inherit
with:
version: ${{ needs.determine-version.outputs.VERSION }}

publish-to-swaggerhub:
name: "Publish OpenAPI spec to Swaggerhub"
permissions:
contents: read
needs: [ secret-presence ]
needs: [ secret-presence, determine-version ]
if: needs.secret-presence.outputs.HAS_SWAGGER
uses: ./.github/workflows/publish-swaggerhub.yaml
secrets: inherit
with:
downstream-version: ${{ needs.determine-version.outputs.VERSION }}

publish-openapi-to-gh-pages:
name: "Publish OpenAPI UI spec GitHub Pages"
permissions:
contents: read
needs: [ secret-presence, determine-version ]
uses: ./.github/workflows/publish-openapi-ui.yml
secrets: inherit
with:
version: ${{ needs.determine-version.outputs.VERSION }}
11 changes: 7 additions & 4 deletions .github/workflows/publish-openapi-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
name: publish openapi ui

on:
push:
branches:
- main
- release/*

workflow_dispatch:
inputs:
Expand All @@ -33,6 +29,13 @@ on:
description: "Version of the Tractus-X EDC API to be should be published"
type: string

workflow_call:
inputs:
version:
required: false
description: "Version of the Tractus-X EDC API to be should be published"
type: string

jobs:
generate-openapi-spec:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/run-all-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ on:
pull_request:
workflow_dispatch:

schedule:
- cron: 0 3 * * 1 # run on 03:00 UTC every Monday

concurrency:
# cancel older running jobs on the same branch
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -62,6 +65,7 @@ jobs:
needs:
- verify
- deployment-test
- upgradeability-test
runs-on: ubuntu-latest
steps:
- name: 'Master test job'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/trigger-docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v4
- name: Log inputs
run: |
echo "Input Version: ${{ inputs.version }}, Input namespace: ${{ inputs.namespace}}"
- uses: ./.github/actions/publish-docker-image
name: Publish ${{ matrix.variant.img }}
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/trigger-maven-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }}
run: |-

echo "Input Version: ${{ inputs.version }}"

# check if version input was specified, else read from gradle.properties

if [ ! -z ${{ inputs.version }} ];
Expand Down
Loading