Skip to content

Continuous Build & Release #101

Continuous Build & Release

Continuous Build & Release #101

name: Continuous Build & Release
on:
workflow_dispatch:
push:
branches: [master]
paths:
- "cmake_modules/**"
- "lib/**"
- "cli/**"
- "tests/**"
- "CMakeLists.txt"
- "CMakePresets.json"
- "vcpkg.json"
- ".github/workflows/continuos-release.yml"
- ".github/workflows/build-artifacts.yml"
# Cancel in-progress runs when a new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Build/package all platforms via the shared reusable workflow
build:
uses: ./.github/workflows/build-artifacts.yml
create-release:
needs: [build]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
merge-multiple: true
path: ./artifacts
- name: Generate changelog
run: |
cat > CHANGELOG.md << 'HEADER'
## Continuous Build
Latest automated build from `master` branch.
### Downloads
#### Windows
HEADER
for file in artifacts/*-setup.exe; do
[ -f "$file" ] && echo "- [$(basename "$file")](https://github.com/${{ github.repository }}/releases/download/continuous/$(basename "$file")) - Installer (recommended)" >> CHANGELOG.md
done
for file in artifacts/*windows*.exe; do
[[ -f "$file" && ! "$file" == *-setup.exe ]] && echo "- [$(basename "$file")](https://github.com/${{ github.repository }}/releases/download/continuous/$(basename "$file")) - Portable" >> CHANGELOG.md
done
echo "" >> CHANGELOG.md
echo "#### Linux" >> CHANGELOG.md
for file in artifacts/*.AppImage; do
[ -f "$file" ] && echo "- [$(basename "$file")](https://github.com/${{ github.repository }}/releases/download/continuous/$(basename "$file")) - AppImage (universal)" >> CHANGELOG.md
done
for file in artifacts/*.deb; do
[ -f "$file" ] && echo "- [$(basename "$file")](https://github.com/${{ github.repository }}/releases/download/continuous/$(basename "$file")) - Debian/Ubuntu" >> CHANGELOG.md
done
for file in artifacts/*.rpm; do
[ -f "$file" ] && echo "- [$(basename "$file")](https://github.com/${{ github.repository }}/releases/download/continuous/$(basename "$file")) - Fedora/RHEL" >> CHANGELOG.md
done
for file in artifacts/*linux*.zip; do
[ -f "$file" ] && echo "- [$(basename "$file")](https://github.com/${{ github.repository }}/releases/download/continuous/$(basename "$file")) - Portable" >> CHANGELOG.md
done
echo "" >> CHANGELOG.md
echo "#### macOS" >> CHANGELOG.md
for file in artifacts/*macos*.zip; do
[ -f "$file" ] && echo "- [$(basename "$file")](https://github.com/${{ github.repository }}/releases/download/continuous/$(basename "$file")) - Portable (universal, macOS 13.3+)" >> CHANGELOG.md
done
cat >> CHANGELOG.md << 'FOOTER'
### Checksums (SHA256)
```
FOOTER
cat artifacts/*.sha256 >> CHANGELOG.md 2>/dev/null || true
echo '```' >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "---" >> CHANGELOG.md
echo "*Built from [\`${GITHUB_SHA:0:7}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})*" >> CHANGELOG.md
- name: Create/Update release
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
with:
tag: continuous
name: 'Continuous Build'
bodyFile: CHANGELOG.md
artifacts: "artifacts/*"
allowUpdates: true
removeArtifacts: true
prerelease: true
makeLatest: false
token: ${{ secrets.GITHUB_TOKEN }}