-
Notifications
You must be signed in to change notification settings - Fork 2.7k
105 lines (90 loc) · 3.31 KB
/
build_backend.yml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: 'Build: Backend'
on:
schedule:
- cron: '0 3 * * 4' # At 03:00 on every Thursday
workflow_dispatch:
inputs:
build_mode:
description: 'Build mode: devel, testing, stable'
default: 'devel'
required: true
publish:
description: 'Publish: on - publish'
default: 'off'
required: false
workflow_call:
inputs:
build_mode:
description: 'Build mode: devel, nightly, testing, stable'
default: 'devel'
type: string
required: true
publish:
description: 'Publish: on - publish'
default: 'off'
type: string
required: false
jobs:
backend:
runs-on: ubuntu-20.04
if: github.event_name != 'schedule' || github.repository == 'musescore/MuseScore'
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v4
- name: "Configure workflow"
run: |
bash ./buildscripts/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ inputs.build_mode }}
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
bash ./buildscripts/ci/tools/make_build_number.sh
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
DO_PUBLISH='false'
if [ "${{ inputs.publish }}" = "on" ]; then
DO_PUBLISH='true';
if [ -z "${{ secrets.S3_KEY_CONVERTER }}" ]; then
echo "::warning::S3_KEY_CONVERTER is empty; publishing to S3 disabled"
DO_PUBLISH='false'
fi
if [ -z "${{ secrets.S3_SECRET_CONVERTER }}" ]; then
echo "::warning::S3_SECRET_CONVERTER is empty; publishing to S3 disabled"
DO_PUBLISH='false'
fi
fi
bash ./buildscripts/ci/tools/make_version_env.sh $BUILD_NUMBER
VERSION=$(cat ./build.artifacts/env/build_version.env)
GITHUB_ARTIFACT_NAME="MuseScore-${VERSION}"
echo "github.repository: ${{ github.repository }}"
echo "BUILD_MODE=$BUILD_MODE" | tee -a $GITHUB_ENV
echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV
echo "DO_PUBLISH=$DO_PUBLISH" | tee -a $GITHUB_ENV
echo "GITHUB_ARTIFACT_NAME=$GITHUB_ARTIFACT_NAME" | tee -a $GITHUB_ENV
- name: Setup environment
run: |
bash ./buildscripts/ci/backend/setup.sh
- name: Build
run: |
bash ./buildscripts/ci/backend/build.sh -n ${{ env.BUILD_NUMBER }} --build_videoexport
- name: Package
run: |
bash ./buildscripts/ci/backend/package.sh
- name: Publish to S3
if: env.DO_PUBLISH == 'true'
run: |
bash ./buildscripts/ci/backend/publish_to_s3.sh --s3_key ${{ secrets.S3_KEY_CONVERTER }} --s3_secret ${{ secrets.S3_SECRET_CONVERTER }}
- name: Build Docker
if: env.DO_PUBLISH == 'true'
run: |
bash ./buildscripts/ci/backend/build_docker.sh
- name: Publish to Registry
if: env.DO_PUBLISH == 'true'
run: |
bash ./buildscripts/ci/backend/publish_to_registry.sh --token ${{ secrets.PACKAGES_PAT }}
- name: Upload artifacts on GitHub
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.GITHUB_ARTIFACT_NAME }}
path: ./build.artifacts/