|
| 1 | +# GitHub Action to build releases on command |
| 2 | +# |
| 3 | +# This script builds and packages a release for Linux, Windows, OSX and FreeBSD |
| 4 | +# using the stable branch. The generated archives are published as a release |
| 5 | +# on the GitHub release page. |
| 6 | +# |
| 7 | +# Job overview: |
| 8 | +# 1. Builds the actual release using `build_release_template` from dlang/installer |
| 9 | +# 2. Publishes all artifacts from (1) to the release page on GitHub |
| 10 | +# |
| 11 | +# Triggered manually by authorized users via workflow_dispatch. |
| 12 | + |
| 13 | +name: build-release |
| 14 | + |
| 15 | +on: |
| 16 | + workflow_dispatch: |
| 17 | + inputs: |
| 18 | + branch: |
| 19 | + description: 'Branch to build from' |
| 20 | + required: true |
| 21 | + type: string |
| 22 | + default: stable |
| 23 | + tag: |
| 24 | + description: 'Release tag (e.g., v2.109.0)' |
| 25 | + required: true |
| 26 | + type: string |
| 27 | + prerelease: |
| 28 | + description: 'Mark as pre-release' |
| 29 | + required: false |
| 30 | + type: boolean |
| 31 | + default: false |
| 32 | + |
| 33 | +jobs: |
| 34 | + # Build and package a new release for all supported platforms |
| 35 | + build-all-releases: |
| 36 | + name: Build release from ${{ github.event.inputs.branch }} |
| 37 | + uses: dlang/installer/.github/workflows/build_release_template.yml@master |
| 38 | + with: |
| 39 | + release_branch: ${{ github.event.inputs.branch }} |
| 40 | + |
| 41 | + # Bundles and publishes the entire release |
| 42 | + generate_release: |
| 43 | + name: "Publish artifacts on the release page" |
| 44 | + needs: |
| 45 | + - build-all-releases |
| 46 | + runs-on: ubuntu-latest |
| 47 | + |
| 48 | + steps: |
| 49 | + ################################################################# |
| 50 | + # Fetch all artifacts from the jobs defined above |
| 51 | + # |
| 52 | + - name: Download generated releases from the artifacts |
| 53 | + uses: actions/download-artifact@v4 |
| 54 | + with: |
| 55 | + pattern: dmd-release-* |
| 56 | + merge-multiple: true |
| 57 | + path: ~/artifacts/ |
| 58 | + |
| 59 | + ################################################################# |
| 60 | + # Debug: Check that all required artifacts are present |
| 61 | + # |
| 62 | + - name: Display all files included in the artifacts |
| 63 | + id: list-artifacts |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + set -euox pipefail |
| 67 | + ls -aul ~ ~/artifacts |
| 68 | + echo "artifacts_directory=$HOME/artifacts" >> $GITHUB_OUTPUT |
| 69 | +
|
| 70 | + ################################################################# |
| 71 | + # Create the new release using the downloaded artifacts |
| 72 | + # |
| 73 | + - name: Create the release |
| 74 | + uses: ncipollo/release-action@v1 |
| 75 | + with: |
| 76 | + token: "${{ secrets.GITHUB_TOKEN }}" |
| 77 | + name: DMD ${{ github.event.inputs.tag }} |
| 78 | + prerelease: ${{ github.event.inputs.prerelease }} |
| 79 | + body: | |
| 80 | + Release of the reference D compiler |
| 81 | +
|
| 82 | + | Component | Revision | |
| 83 | + | --------- | ---------------------------------------------------------------- | |
| 84 | + | DMD | dlang/dmd@${{ needs.build-all-releases.outputs.dmd-revision }} | |
| 85 | + | Phobos | dlang/phobos@${{ needs.build-all-releases.outputs.phobos-revision }} | |
| 86 | +
|
| 87 | + artifacts: ${{ steps.list-artifacts.outputs.artifacts_directory }}/* |
| 88 | + artifactErrorsFailBuild: true |
| 89 | + tag: ${{ github.event.inputs.tag }} |
| 90 | + commit: ${{ needs.build-all-releases.outputs.dmd-revision }} |
0 commit comments