Skip to content

feat(build): publish to OSSRH Snapshots and MavenCentral from GHA #24

feat(build): publish to OSSRH Snapshots and MavenCentral from GHA

feat(build): publish to OSSRH Snapshots and MavenCentral from GHA #24

name: Create EDC Component Release
on:
workflow_call:
inputs:
component_version:
required: true
type: string
secrets:
github_token:

Check failure on line 10 in .github/workflows/release-component.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release-component.yml

Invalid workflow file

secret name `github_token` within `workflow_call` can not be used since it would collide with system reserved name
required: true
jobs:
Prepare-Release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# create tag on the current branch using GitHub's own API
- name: Create tag on current branch (main)
uses: actions/github-script@v6
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ inputs.component_version }}',
sha: context.sha
})
# create merge commit main -> releases encoding the version in the commit message
- name: Merge main -> releases
uses: everlytic/[email protected]
with:
github_token: ${{ github.token }}
source_ref: ${{ github.ref }}
target_branch: 'releases'
commit_message_template: 'Merge commit for release of version v${{ inputs.component_version }}'
outputs:
component-version: ${{ inputs.component_version }}
GitHub-Release:
# cannot use the workflow-level env yet as it does not yet exist, must take output from previous job
if: ${{ !endsWith( needs.Prepare-Release.outputs.component-version, '-SNAPSHOT') }}
needs:
- Prepare-Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
tag: "v${{ inputs.component_version }}"
token: ${{ secrets.github_token }}
removeArtifacts: true
Bump-Version:
name: 'Update release version'
# cannot use the workflow-level env yet as it does not yet exist, must take output from previous job
if: ${{ !endsWith( needs.Prepare-Release.outputs.component-version, '-SNAPSHOT') }}
needs: [ Prepare-Release, GitHub-Release ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bump-version
with:
target_branch: "main"
base_version: ${{ needs.Prepare-Release.outputs.component-version }}