master push run 🚀 #6
This file contains hidden or 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: Push | |
| run-name: ${{ github.ref_name }} push run 🚀 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| - 'release/**' | |
| tags: | |
| - '*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| check-format: | |
| name: Check Formatting 🔍 | |
| if: github.ref_name == 'master' || github.ref_name == 'main' | |
| uses: ./.github/workflows/check-format.yaml | |
| permissions: | |
| contents: read | |
| build-project: | |
| name: Build Project 🧱 | |
| uses: ./.github/workflows/build-project.yaml | |
| secrets: inherit | |
| permissions: | |
| contents: read | |
| publish-nightly: | |
| name: Publish Plugin Build 📦 | |
| needs: build-project | |
| if: ${{ always() && needs.build-project.result != 'cancelled' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') }} | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| actions: read | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Download Windows Plugin 📥 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: obs-filters-hotkey-*-windows-x64-* | |
| merge-multiple: true | |
| - name: Download macOS Plugin 📥 | |
| uses: actions/download-artifact@v4 | |
| continue-on-error: true | |
| with: | |
| pattern: obs-filters-hotkey-*-macos-universal-* | |
| merge-multiple: true | |
| - name: Download Linux Plugin 📥 | |
| uses: actions/download-artifact@v4 | |
| continue-on-error: true | |
| with: | |
| pattern: obs-filters-hotkey-*-ubuntu-24.04-x86_64-* | |
| merge-multiple: true | |
| - name: Prepare Release Assets 🏷️ | |
| run: | | |
| : Prepare Release Assets 🏷️ | |
| if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi | |
| mkdir -p release-assets | |
| find . -type f \( -name '*.zip' -o -name '*.tar.xz' -o -name '*.deb' -o -name '*.pkg' \) \ | |
| ! -path './release-assets/*' -exec cp {} release-assets/ \; | |
| if [[ ! "$(ls -A release-assets)" ]]; then | |
| echo "No build artifacts found to publish." | |
| exit 1 | |
| fi | |
| ls -la release-assets/ | |
| - name: Publish Nightly Release 🚀 | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: nightly | |
| name: Nightly Plugin Build | |
| body: | | |
| Automated build of the OBS Filters Hotkey native plugin. | |
| Download the zip for Windows, tar.xz for Linux, or pkg/tar.xz for macOS. | |
| Commit: ${{ github.sha }} | |
| files: release-assets/* | |
| prerelease: true | |
| make_latest: false | |
| create-release: | |
| name: Create Release 🛫 | |
| if: github.ref_type == 'tag' | |
| runs-on: ubuntu-24.04 | |
| needs: build-project | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Check Release Tag ☑️ | |
| id: check | |
| run: | | |
| : Check Release Tag ☑️ | |
| if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi | |
| shopt -s extglob | |
| case "${GITHUB_REF_NAME}" in | |
| +([0-9]).+([0-9]).+([0-9]) ) | |
| echo 'validTag=true' >> $GITHUB_OUTPUT | |
| echo 'prerelease=false' >> $GITHUB_OUTPUT | |
| echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
| ;; | |
| +([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) ) | |
| echo 'validTag=true' >> $GITHUB_OUTPUT | |
| echo 'prerelease=true' >> $GITHUB_OUTPUT | |
| echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | |
| ;; | |
| *) echo 'validTag=false' >> $GITHUB_OUTPUT ;; | |
| esac | |
| - name: Download Build Artifacts 📥 | |
| uses: actions/download-artifact@v4 | |
| if: fromJSON(steps.check.outputs.validTag) | |
| id: download | |
| - name: Rename Files 🏷️ | |
| if: fromJSON(steps.check.outputs.validTag) | |
| run: | | |
| : Rename Files 🏷️ | |
| if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi | |
| shopt -s extglob | |
| shopt -s nullglob | |
| root_dir="$(pwd)" | |
| commit_hash="${GITHUB_SHA:0:9}" | |
| variants=( | |
| 'windows-x64;zip|exe' | |
| 'macos-universal;tar.xz|pkg' | |
| 'ubuntu-24.04-x86_64;tar.xz|deb|ddeb' | |
| 'sources;tar.xz' | |
| ) | |
| for variant_data in "${variants[@]}"; do | |
| IFS=';' read -r variant suffix <<< "${variant_data}" | |
| candidates=(*-${variant}-${commit_hash}/@(*|*-dbgsym).@(${suffix})) | |
| for candidate in "${candidates[@]}"; do | |
| mv "${candidate}" "${root_dir}" | |
| done | |
| done | |
| - name: Generate Checksums 🪪 | |
| if: fromJSON(steps.check.outputs.validTag) | |
| run: | | |
| : Generate Checksums 🪪 | |
| if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi | |
| shopt -s extglob | |
| echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt | |
| for file in ${{ github.workspace }}/@(*.exe|*.deb|*.ddeb|*.pkg|*.tar.xz|*.zip); do | |
| echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt | |
| done | |
| - name: Create Release 🛫 | |
| if: fromJSON(steps.check.outputs.validTag) | |
| id: create_release | |
| uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 | |
| with: | |
| draft: true | |
| prerelease: ${{ fromJSON(steps.check.outputs.prerelease) }} | |
| tag_name: ${{ steps.check.outputs.version }} | |
| name: ${{ needs.build-project.outputs.pluginName }} ${{ steps.check.outputs.version }} | |
| body_path: ${{ github.workspace }}/CHECKSUMS.txt | |
| files: | | |
| ${{ github.workspace }}/*.exe | |
| ${{ github.workspace }}/*.zip | |
| ${{ github.workspace }}/*.pkg | |
| ${{ github.workspace }}/*.deb | |
| ${{ github.workspace }}/*.ddeb | |
| ${{ github.workspace }}/*.tar.xz |