| 1 | name: Create EDC Release |
| 2 | on: |
| 3 | workflow_dispatch: |
| 4 | inputs: |
| 5 | edc_version: |
| 6 | description: 'Version string that is used for publishing (e.g. "1.0.0", NOT "v1.0.0"). Appending -SNAPSHOT will create a snapshot release.' |
| 7 | required: true |
| 8 | type: string |
| 9 | |
| 10 | |
| 11 | env: |
| 12 | EDC_VERSION: ${{ github.event.inputs.edc_version || inputs.edc_version }} |
| 13 | |
| 14 | jobs: |
| 15 | Prepare-Release: |
| 16 | runs-on: ubuntu-latest |
| 17 | steps: |
| 18 | - uses: actions/checkout@v4 |
| 19 | |
| 20 | # create tag on the current branch using GitHub's own API |
| 21 | - name: Create tag on current branch (main) |
| 22 | uses: actions/github-script@v7 |
| 23 | with: |
| 24 | script: | |
| 25 | github.rest.git.createRef({ |
| 26 | owner: context.repo.owner, |
| 27 | repo: context.repo.repo, |
| 28 | ref: 'refs/tags/v${{ env.EDC_VERSION }}', |
| 29 | sha: context.sha |
| 30 | }) |
| 31 | |
| 32 | # create merge commit main -> releases encoding the version in the commit message |
| 33 | - name: Merge main -> releases |
| 34 | uses: everlytic/branch-merge@1.1.5 |
| 35 | with: |
| 36 | github_token: ${{ github.token }} |
| 37 | source_ref: ${{ github.ref }} |
| 38 | target_branch: 'releases' |
| 39 | commit_message_template: 'Merge commit for release of version v${{ env.EDC_VERSION }}' |
| 40 | |
| 41 | outputs: |
| 42 | edc-version: ${{ env.EDC_VERSION }} |
| 43 | |
| 44 | publish-autodoc: |
| 45 | needs: Prepare-Release |
| 46 | uses: eclipse-edc/.github/.github/workflows/publish-autodoc.yml@main |
| 47 | secrets: inherit |
| 48 | with: |
| 49 | version: ${{ needs.Prepare-Release.outputs.edc-version }} |
| 50 | |
| 51 | Github-Release: |
| 52 | # cannot use the workflow-level env yet as it does not yet exist, must take output from previous job |
| 53 | if: ${{ !endsWith( needs.Prepare-Release.outputs.edc-version, '-SNAPSHOT') }} |
| 54 | needs: |
| 55 | - Prepare-Release |
| 56 | runs-on: ubuntu-latest |
| 57 | permissions: |
| 58 | contents: write |
| 59 | steps: |
| 60 | - uses: actions/checkout@v4 |
| 61 | with: |
| 62 | ref: main |
| 63 | - name: Create GitHub Release |
| 64 | uses: ncipollo/release-action@v1 |
| 65 | with: |
| 66 | generateReleaseNotes: true |
| 67 | tag: "v${{ env.EDC_VERSION }}" |
| 68 | token: ${{ secrets.GITHUB_TOKEN }} |
| 69 | removeArtifacts: true |
| 70 | |
| 71 | Bump-Version: |
| 72 | name: 'Update release version' |
| 73 | # cannot use the workflow-level env yet as it does not yet exist, must take output from previous job |
| 74 | if: ${{ !endsWith( needs.Prepare-Release.outputs.edc-version, '-SNAPSHOT') }} |
| 75 | needs: [ Prepare-Release, Github-Release ] |
| 76 | runs-on: ubuntu-latest |
| 77 | steps: |
| 78 | - uses: actions/checkout@v4 |
| 79 | - uses: eclipse-edc/.github/.github/actions/bump-version@main |
| 80 | with: |
| 81 | target_branch: "main" |
| 82 | base_version: ${{ needs.Prepare-Release.outputs.edc-version }} |