Release #14
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Semantic Version string to use for this release | |
required: true | |
branch: | |
description: Source ranch from which the version should be created. If omitted, 'main' is used. | |
required: false | |
default: "main" | |
env: | |
INPUT_VERSION: ${{ github.event.inputs.version || inputs.version }} | |
INPUT_SOURCE_BRANCH: ${{ github.event.inputs.branch || inputs.branch }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
Secrets-Presence: | |
name: "Check for required credentials" | |
runs-on: ubuntu-latest | |
outputs: | |
HAS_GH_PAT: ${{ steps.secrets-presence.outputs.HAS_GH_PAT }} | |
HAS_WEBHOOK: ${{ steps.secrets-presence.outputs.HAS_WEBHOOK }} | |
steps: | |
- name: Check whether secrets exist | |
id: secrets-presence | |
run: | | |
[ ! -z "${{ secrets.ORG_GITHUB_BOT_USER }}" ] && | |
[ ! -z "${{ secrets.ORG_GITHUB_BOT_TOKEN }}" ] && echo "HAS_GH_PAT=true" >> $GITHUB_OUTPUT | |
[ ! -z "${{ secrets.DISCORD_WEBHOOK_GITHUB }}" ] && echo "HAS_WEBHOOK=true" >> $GITHUB_OUTPUT | |
exit 0 | |
Determine-Version: | |
# this looks to be necessary because some constructs as "with" are not able to get values from env | |
runs-on: ubuntu-latest | |
outputs: | |
VERSION: ${{ steps.get-version.outputs.VERSION }} | |
steps: | |
- name: "Extract version" | |
id: get-version | |
run: echo "VERSION=${{ env.INPUT_VERSION }}" >> "$GITHUB_OUTPUT" | |
Determine-Branch: | |
# this looks to be necessary because some constructs as "with" are not able to get values from env | |
runs-on: ubuntu-latest | |
outputs: | |
SOURCE_BRANCH: ${{ steps.get-branch.outputs.BRANCH }} | |
steps: | |
- name: "Get branch" | |
id: get-branch | |
run: echo "SOURCE_BRANCH=${{ env.INPUT_SOURCE_BRANCH }}" >> "$GITHUB_OUTPUT" | |
Run-All-Tests: | |
name: "Run tests" | |
runs-on: ubuntu-latest | |
needs: [ Secrets-Presence, Determine-Version ] | |
if: | | |
needs.Secrets-Presence.outputs.HAS_GH_PAT | |
strategy: | |
fail-fast: false | |
matrix: | |
test-def: [ { repo: "runtime-metamodel", workflowfile: "ci.yaml" }, | |
{ repo: "gradleplugins", workflowfile: "test.yaml" }, | |
{ repo: "connector", workflowfile: "verify.yaml" }, | |
{ repo: "identityhub", workflowfile: "verify.yaml" }, | |
{ repo: "federatedcatalog", workflowfile: "verify.yaml" } ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Run test for ${{ matrix.test-def.repo }}" | |
run: | | |
chmod +x ./scripts/github_action.sh | |
./scripts/github_action.sh "eclipse-edc" "${{ matrix.test-def.repo }}" "${{ matrix.test-def.workflowfile}}" "" "${{ secrets.ORG_GITHUB_BOT_USER }}" "${{ secrets.ORG_GITHUB_BOT_TOKEN }}" "${{ env.INPUT_SOURCE_BRANCH }}" | |
Publish-Components: | |
needs: [ Determine-Version, Determine-Branch, Run-All-Tests ] | |
uses: ./.github/workflows/publish-all-in-one.yaml | |
with: | |
version: ${{ needs.Determine-Version.outputs.VERSION }} | |
branch: "${{ needs.Determine-Branch.outputs.SOURCE_BRANCH }}" | |
secrets: inherit | |
Release-Components: | |
name: "Release Components" | |
runs-on: ubuntu-latest | |
needs: [Secrets-Presence, Determine-Version, Determine-Branch, Publish-Components ] | |
if: | | |
needs.Secrets-Presence.outputs.HAS_GH_PAT && | |
needs.Determine-Branch.outputs.SOURCE_BRANCH == 'main' | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: | |
test-def: [ { repo: "runtime-metamodel", workflowfile: "release-rm.yml", versionfield: "edc_version" }, | |
{ repo: "gradleplugins", workflowfile: "release-all-java.yml", versionfield: "metamodel_version" }, | |
{ repo: "connector", workflowfile: "release-edc.yml", versionfield: "edc_version" }, | |
{ repo: "identityhub", workflowfile: "release-identityhub.yml", versionfield: "ih_version" }, | |
{ repo: "federatedcatalog", workflowfile: "release-fcc.yml", versionfield: "edc_version" }] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Log version" | |
run: | | |
echo "Will release version ${{ needs.Determine-Version.outputs.VERSION }}" | |
- name: "Release ${{ matrix.test-def.repo }}" | |
run: | | |
chmod +x ./scripts/github_action.sh | |
./scripts/github_action.sh "eclipse-edc" "${{ matrix.test-def.repo }}" "${{ matrix.test-def.workflowfile}}" "{\"${{ matrix.test-def.versionfield }}\": \"${{ needs.Determine-Version.outputs.VERSION }}\"}" "${{ secrets.ORG_GITHUB_BOT_USER }}" "${{ secrets.ORG_GITHUB_BOT_TOKEN }}" | |
- name: "Publish new SNAPSHOT version for ${{ matrix.test-def.repo }}" | |
run: | | |
chmod +x ./scripts/github_action.sh | |
./scripts/github_action.sh "eclipse-edc" "${{ matrix.test-def.repo }}" "trigger_snapshot.yml" "" "${{ secrets.ORG_GITHUB_BOT_USER }}" "${{ secrets.ORG_GITHUB_BOT_TOKEN }}" | |
Post-To-Discord: | |
needs: [ Publish-Components, Release-Components, Determine-Version, Secrets-Presence ] | |
if: needs.Secrets-Presence.outputs.HAS_WEBHOOK && always() | |
runs-on: ubuntu-latest | |
steps: | |
- uses: sarisia/actions-status-discord@v1 | |
name: "Invoke discord webhook" | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK_GITHUB }} | |
# if the publishing is skipped, that means the preceding test run failed | |
status: ${{ needs.Publish-Components.result == 'skipped' && 'Failure' || needs.Publish-Components.result }} | |
title: "Nightly Build" | |
description: "Build and publish ${{ needs.Determine-Version.outputs.VERSION }}" | |
username: GitHub Actions |