Build: Backend #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: '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 | |
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'; fi | |
if [ -z "${{ secrets.S3_KEY_CONVERTER }}" ]; then DO_PUBLISH='false'; fi | |
if [ -z "${{ secrets.S3_SECRET_CONVERTER }}" ]; then DO_PUBLISH='false'; 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" >> $GITHUB_ENV | |
echo "BUILD_MODE: $BUILD_MODE" | |
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV | |
echo "BUILD_NUMBER: $BUILD_NUMBER" | |
echo "DO_PUBLISH=$DO_PUBLISH" >> $GITHUB_ENV | |
echo "DO_PUBLISH: $DO_PUBLISH" | |
echo "GITHUB_ARTIFACT_NAME=$GITHUB_ARTIFACT_NAME" >> $GITHUB_ENV | |
echo "GITHUB_ARTIFACT_NAME: $GITHUB_ARTIFACT_NAME" | |
- name: Setup environment | |
run: | | |
sudo bash ./buildscripts/ci/backend/setup.sh | |
- name: Build | |
run: | | |
sudo bash ./buildscripts/ci/backend/build.sh -n ${{ env.BUILD_NUMBER }} --build_videoexport | |
- name: Package | |
run: | | |
sudo bash ./buildscripts/ci/backend/package.sh | |
- name: Publish to S3 | |
if: env.DO_PUBLISH == 'true' | |
run: | | |
sudo 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: | | |
sudo bash ./buildscripts/ci/backend/build_docker.sh | |
- name: Publish to Registry | |
if: env.DO_PUBLISH == 'true' | |
run: | | |
sudo 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/ |