generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 15
86 lines (77 loc) · 2.99 KB
/
deploy-snapshot.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Deploy Snapshot to Maven Central
on:
workflow_dispatch:
inputs:
skip_blackduck_scan:
description: "Skip Blackduck Scan"
type: boolean
default: false
required: false
env:
CI_BUILD_WORKFLOW: "continuous-integration.yaml" # Name of the workflow that should be triggered for CI builds
RELEASE_ARTIFACT_NAME: "release-artifacts" # Name of the artifact that should be downloaded from the CI build workflow
MVN_CLI_ARGS: "--batch-mode --no-transfer-progress --fail-at-end --show-version"
jobs:
run-ci:
name: "Continuous Integration"
runs-on: ubuntu-latest
outputs:
ci-run-id: ${{ steps.trigger-ci.outputs.run-id }}
permissions:
actions: write # needed to trigger the ci-build workflow
statuses: write # needed to update the commit status
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Get Commit SHA"
run: echo "COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: "Get Branch Name"
run: echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: "Trigger CI Workflow"
id: trigger-ci
uses: ./.github/actions/trigger-workflow
with:
workflow: ${{ env.CI_BUILD_WORKFLOW }}
workflow-ref: ${{ env.BRANCH_NAME }}
commit-sha: ${{ env.COMMIT_SHA }}
parameters: >
-f commit=${{ env.COMMIT_SHA }}
-f build-release-artifacts=true
-f run-blackduck-scan=${{ !github.event.inputs.skip_blackduck_scan }}
- name: "Await CI Workflow"
uses: ./.github/actions/await-workflow
with:
run-id: ${{ steps.trigger-ci.outputs.run-id }}
commit-status: "Continuous Integration Workflow"
deploy-snapshot:
name: Deploy Snapshot
needs: [ run-ci ]
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read # needed to download the artifacts from the ci-build workflow
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: "Deploy Snapshot"
uses: ./.github/actions/deploy-snapshot
with:
ci-run-id: ${{ needs.run-ci.outputs.ci-run-id }}
repository-url: "https://oss.sonatype.org/content/repositories/snapshots"
repository-username: ${{ secrets.MAVEN_CENTRAL_USER }}
repository-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
release-artifact-name: ${{ env.RELEASE_ARTIFACT_NAME }}
notify-job:
runs-on: ubuntu-latest
needs: [ run-ci, deploy-snapshot ]
if: ${{ failure() && github.ref == 'refs/heads/main' }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Notify"
run: python .pipeline/scripts/notify.py
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
WORKFLOW: ${{ github.workflow }}
WORKFLOW_RUN_URL: https://github.com/SAP/cloud-sdk-java/actions/runs/${{ github.run_id }}
BRANCH_NAME: ${{ github.ref_name }}