Build and Release Composer #24
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 and Release Composer | |
# Controls when the workflow will run | |
on: | |
# Run on a schedule to get monthly updates | |
schedule: | |
- cron: "0 0 28 * *" | |
# Triggers the workflow on merges to master, release branches, | |
# all PRs, and release tags | |
push: | |
branches: | |
- master | |
- '[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+' | |
tags: | |
- '[0-9]+\.[0-9]+\.[0-9]+' | |
- '[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+' | |
# On anything pull request related | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Note: entire jobs or sections can be disabled by adding | |
# if: ${{ false }} to the definition column | |
jobs: | |
# Determine version | |
determine_version: | |
name: Determine the version to be used | |
runs-on: ubuntu-latest | |
outputs: | |
latest_tag_version: ${{ steps.versioning.outputs.latest_tag_version }} | |
latest_full_tag_version: ${{ steps.versioning.outputs.latest_full_tag_version }} | |
version_major: ${{ steps.versioning.outputs.version_major }} | |
version_minor: ${{ steps.versioning.outputs.version_minor }} | |
version_patch: ${{ steps.versioning.outputs.version_patch }} | |
version_tweak: ${{ steps.versioning.outputs.version_tweak }} | |
complete_version: ${{ steps.versioning.outputs.complete_version }} | |
steps: | |
- name: Determine the complete version | |
id: versioning | |
run: | | |
# Always check the tags on master since it will have the latest. | |
# Tags will trigger their own workflow and version names | |
git clone --recursive ${{ github.server_url }}/${{ github.repository }} performous_composer | |
cd performous_composer | |
LATEST_TAG_VERSION=$(git describe --tags --abbrev=0 || echo 1.0.0) | |
LATEST_FULL_TAG_VERSION=$(git describe --tags || echo 1.0.0) | |
echo "latest_tag_version=$(git describe --tags --abbrev=0 || echo 1.0.0)" >> $GITHUB_OUTPUT | |
echo "latest_full_tag_version=$(git describe --tags || echo 1.0.0)" >> $GITHUB_OUTPUT | |
echo "version_major=$(cut -d '.' -f 1 <<< $(git describe --tags --abbrev=0 || echo 1.0.0))" >> $GITHUB_OUTPUT | |
echo "version_minor=$(cut -d '.' -f 2 <<< $(git describe --tags --abbrev=0 || echo 1.0.0))" >> $GITHUB_OUTPUT | |
echo "version_patch=$(cut -d '.' -f 3 <<< $(git describe --tags --abbrev=0 || echo 1.0.0))" >> $GITHUB_OUTPUT | |
echo "version_tweak=0" >> $GITHUB_OUTPUT | |
echo "complete_version=$(if [ $GITHUB_REF_TYPE = 'tag' ]; then echo $GITHUB_REF_NAME; elif [ $GITHUB_REF_TYPE = 'branch' ] && [ $GITHUB_REF_NAME = 'master' ]; then echo $LATEST_FULL_TAG_VERSION-beta; elif [ $GITHUB_REF_TYPE = 'branch' ] && [ $GITHUB_REF_NAME != 'master' ]; then echo $LATEST_TAG_VERSION-${{github.event.pull_request.number}}-${GITHUB_SHA::7}-alpha; fi)" >> $GITHUB_OUTPUT | |
# Set up a release that packages will be published to. | |
create_release: | |
name: Create a release | |
runs-on: ubuntu-latest | |
# Make sure the output variable for this step is set so it | |
# can be consumed by later build steps | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create the Main release | |
id: create_release | |
if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Composer ${{ github.ref_name }} | |
draft: true | |
prerelease: false | |
# Pull in the Linux build workflow | |
Linux_Packages: | |
name: Build the Linux packages | |
uses: ./.github/workflows/linux.yml | |
with: | |
package_complete_version: ${{ needs.determine_version.outputs.complete_version }} | |
release_upload_url: ${{ needs.create_release.outputs.upload_url }} | |
needs: | |
- determine_version | |
- create_release | |
# Pull in the AppImage build workflow | |
AppImage_Package: | |
name: Build the AppImage | |
uses: ./.github/workflows/appimage.yml | |
with: | |
package_complete_version: ${{ needs.determine_version.outputs.complete_version }} | |
release_upload_url: ${{ needs.create_release.outputs.upload_url }} | |
needs: | |
- determine_version | |
- create_release | |
# Pull in the MacOS build workflow | |
#MacOS_Package: | |
# name: Build the MacOS package | |
# uses: ./.github/workflows/macos.yml | |
# with: | |
# package_complete_version: ${{ needs.determine_version.outputs.complete_version }} | |
# release_upload_url: ${{ needs.create_release.outputs.upload_url }} | |
# needs: | |
# - determine_version | |
# - create_release | |
# Pull in the Windows build workflow | |
#Windows_Packages: | |
# name: Build the Windows packages | |
# uses: ./.github/workflows/windows.yml | |
# with: | |
# package_complete_version: ${{ needs.determine_version.outputs.complete_version }} | |
# release_upload_url: ${{ needs.create_release.outputs.upload_url }} | |
# needs: | |
# - determine_version | |
# - create_release |