Merge pull request #18 from databox/release/0.4.1/1720687213698 #6
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: Publish SDK | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'src/**' | |
jobs: | |
release_draft: | |
name: Create release draft | |
runs-on: ubuntu-latest | |
outputs: | |
release_body: ${{ steps.create_release_draft.outputs.body }} | |
release_tag: ${{ steps.create_release_draft.outputs.tag_name }} | |
release_html_url: ${{ steps.create_release_draft.outputs.html_url }} | |
release_id: ${{ steps.create_release_draft.outputs.id }} | |
steps: | |
- name: "Create release draft" | |
id: create_release_draft | |
uses: release-drafter/release-drafter@v6 | |
with: | |
commitish: master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
name: Build and publish SDK package | |
runs-on: ubuntu-latest | |
needs: release_draft | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Maven Action | |
uses: s4u/[email protected] | |
- name: Configure Maven | |
uses: s4u/[email protected] | |
with: | |
githubServer: false | |
servers: | | |
[{ | |
"id": "github", | |
"username": "${{ github.actor }}", | |
"password": "${{ secrets.PACKAGES_PUBLISH_TOKEN }}" | |
}] | |
path: ${{ github.workspace }}/src/.m2/settings.xml | |
- name: Publish SDK | |
run: mvn --batch-mode -DuseGitHubPackages=true -DaltDeploymentRepository=github::https://maven.pkg.github.com/${{ github.repository }} deploy -s .m2/settings.xml | |
env: | |
GITHUB_TOKEN: ${{ secrets.PACKAGES_PUBLISH_TOKEN }} | |
GITHUB_USERNAME: ${{ github.actor }} | |
working-directory: src | |
release_publish: | |
name: Publish release | |
runs-on: ubuntu-latest | |
needs: | |
- release_draft | |
- build | |
steps: | |
- name: "Publish release" | |
uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.release_draft.outputs.release_id }} | |
post_slack_job: | |
name: Post info to Slack in #engeering-releases channel | |
needs: | |
- release_draft | |
- release_publish | |
runs-on: ubuntu-latest | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
steps: | |
- name: Format to Slack msg | |
uses: LoveToKnow/[email protected] | |
id: slack_msg_converter | |
with: | |
text: ${{needs.release_draft.outputs.release_body}} | |
- name: Post to a Slack channel | |
if: success() | |
id: slack | |
uses: slackapi/[email protected] | |
with: | |
channel-id: 'C027FC31SVD' | |
payload: | | |
{ | |
"text": "New version post", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "New <${{ github.server_url }}/${{ github.repository }}|`${{ github.repository }}`> release <${{ github.server_url }}/${{ github.repository }}/releases/${{ needs.create_release_draft_job.outputs.release_tag }}|${{ needs.create_release_draft_job.outputs.release_tag }}> is available! :tada:" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": ${{toJSON(steps.slack_msg_converter.outputs.text)}} | |
} | |
} | |
] | |
} | |