generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 14
77 lines (69 loc) · 2.61 KB
/
main-build.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
name: "Main Build"
on:
push:
branches: [ "main" ]
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
COMMIT_SHA: ${{ github.sha }}
BRANCH_NAME: ${{ github.ref_name }}
MVN_CLI_ARGS: "--batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C"
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: "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
- 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://common.repositories.cloud.sap/artifactory/build-snapshots-cloudsdk"
repository-username: ${{ secrets.ARTIFACTORY_USER }}
repository-password: ${{ secrets.ARTIFACTORY_PASSWORD }}
release-artifact-name: ${{ env.RELEASE_ARTIFACT_NAME }}
notify-job:
runs-on: ubuntu-latest
needs: [ run-ci, deploy-snapshot ]
if: ${{ failure() }}
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: ${{ env.BRANCH_NAME }}