1################################################################################ 2# Build Release Packages for Major Platforms 3# 4# - Builds release packages on multiple operating systems. 5# 6# - Some packages may have to be supplmented with manually-built releases 7# to account for code-signing and/or notorization requirements. 8# 9################################################################################ 10 11name: Build and Publish Packages 12 13on: 14 release: 15 types: [published] 16 17jobs: 18 19 build_packages: 20 runs-on: ${{ matrix.os }} 21 strategy: 22 fail-fast: false 23 matrix: 24 include: 25 26 ############################################################ 27 # Ubuntu latest is a normal build. 28 # Package building requires rpm in order to generate 29 # .rpm packages. The runner already includes this by 30 # default. 31 ############################################################ 32 - os: ubuntu-latest 33 name: Standard 34 cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release" 35 build_command: "cmake --build . --config Release --target package" 36 sha_command: "sha256sum" 37 stat_command: "stat" 38 artifacts: "tidy-%s-Linux-64bit.deb tidy-%s-Linux-64bit.rpm" 39 40 ############################################################ 41 # On macOS, we'll build both architectures. 42 # Package building has all prerequisites install already. 43 ############################################################ 44 - os: macOS-latest 45 name: X86_64 & Arm64 46 cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'" 47 build_command: "cmake --build . --config Release --target package" 48 sha_command: "shasum -a 256" 49 stat_command: "gstat" 50 artifacts: "tidy-%s-macOS-x86_64+arm64.pkg" 51 52 ############################################################ 53 # The standard Windows build is using MSVC 19 as of now. 54 # Package building requires nsis and wixtoolset, both of 55 # which can be installed via choco, which is already 56 # installed. Note: looks like xictoolset is already 57 # installed. 58 ############################################################ 59 - os: windows-latest 60 name: MSVC 61 cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release" 62 build_command: "cmake --build . --config Release --target package" 63 sha_command: "sha256sum" 64 stat_command: "stat" 65 artifacts: "tidy-%s-win64.exe tidy-%s-win64.msi tidy-%s-win64.zip" 66 67 68 steps: 69 70 ############################################################ 71 # Install Windows Pre-Requisites 72 ############################################################ 73 - name: Install Windows Requirements 74 if: ${{matrix.os == 'windows-latest'}} 75 run: | 76 choco install nsis -y 77 78 79 ############################################################ 80 # Install macOS Pre-Requisites 81 ############################################################ 82 - name: Install macOS Requirements 83 if: ${{matrix.os == 'macOS-latest'}} 84 run: | 85 brew install coreutils 86 87 88 ############################################################ 89 # Checkput the repository. 90 ############################################################ 91 - name: Checkout Self 92 uses: actions/checkout@v2 93 94 95 ############################################################ 96 # Get the version number. The output isn't available until 97 # we exit this step. 98 ############################################################ 99 - name: Get Tidy Version 100 id: getversion 101 working-directory: ${{github.workspace}} 102 shell: bash 103 run: | 104 echo "::set-output name=version::$(head -1 version.txt)" 105 106 107 ############################################################ 108 # Print the version number, which is now available from 109 # the previous step. 110 ############################################################ 111 - name: Print Tidy Version 112 shell: bash 113 run: | 114 echo "Tidy version is ${{ steps.getversion.outputs.version }}." 115 116 117 ############################################################ 118 # Configure and Build 119 ############################################################ 120 - name: Configure and Build 121 working-directory: ${{github.workspace}}/build/cmake 122 shell: bash 123 run: | 124 ${{matrix.cmake_command}} 125 ${{matrix.build_command}} 126 127 128 ############################################################ 129 # Move Files and Make Checksums 130 ############################################################ 131 - name: Move Files and Make Checksums 132 working-directory: ${{github.workspace}}/build/cmake 133 shell: bash 134 run: | 135 ls -al 136 mkdir artifacts 137 array="${{matrix.artifacts}}" 138 for i in ${array[@]}; do 139 filename=$(printf "$i\n" ${{ steps.getversion.outputs.version }}) 140 ${{matrix.sha_command}} "$filename" > "artifacts/${filename}.sha256" 141 mv "$filename" "artifacts/" 142 done 143 144 145 ############################################################ 146 # Build Manifest Partials for binaries.html-tidy.org 147 ############################################################ 148 - name: Build Manifest Partials 149 working-directory: ${{github.workspace}}/build/cmake/artifacts 150 shell: bash 151 run: | 152 ls -al 153 manifest="../binaries-partial.yml" 154 touch "${manifest}" 155 for filename in *.*[^sha256]; do 156 filesize=$(numfmt --to=si --suffix=B $(wc -c < ${filename})) 157 modified=$(${{matrix.stat_command}} -c %y "${filename}" | cut -d'.' -f1) 158 sha256=$(${{matrix.sha_command}} "${filename}" | awk '{print $1}') 159 echo " - filename: ${filename}" >> "${manifest}" 160 echo " filesize: ${filesize}" >> "${manifest}" 161 echo " modified: ${modified}" >> "${manifest}" 162 echo " describe: ''" >> "${manifest}" 163 echo " sha256: ${sha256}" >> "${manifest}" 164 echo "" >> "${manifest}" 165 done; 166 cat "${manifest}" 167 168 169 ############################################################ 170 # Release the artifacts. 171 ############################################################ 172 - name: Release 173 uses: softprops/action-gh-release@v1 174 env: 175 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 176 with: 177 #name: "New Draft Release" 178 #tag_name: "v1.2.7" 179 #draft: true 180 #prerelease: true 181 files: "${{github.workspace}}/build/cmake/artifacts/*" 182 183 184 ############################################################ 185 # Post the manifest to the run results. 186 ############################################################ 187 - name: Post the Manifest 188 uses: actions/upload-artifact@v2 189 with: 190 name: "partials_for_website-${{matrix.os}}.yml" 191 path: ${{github.workspace}}/build/cmake/binaries-partial.yml 192