Add CI workflow for automated releases on VERSION changes (#155)
This commit is contained in:
parent
eb0ad035fc
commit
ed5c8eeda0
|
|
@ -0,0 +1,116 @@
|
|||
name: Create Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'VERSION'
|
||||
|
||||
jobs:
|
||||
check-version-change:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
version: ${{ steps.get-version.outputs.version }}
|
||||
should-release: ${{ steps.check-tag.outputs.should-release }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get version from VERSION file
|
||||
id: get-version
|
||||
run: |
|
||||
VERSION=$(cat VERSION)
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "Version: ${VERSION}"
|
||||
|
||||
- name: Check if tag exists
|
||||
id: check-tag
|
||||
run: |
|
||||
VERSION="${{ steps.get-version.outputs.version }}"
|
||||
git fetch --tags
|
||||
if git rev-parse "v${VERSION}" >/dev/null 2>&1; then
|
||||
echo "Tag v${VERSION} already exists, skipping release"
|
||||
echo "should-release=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "Tag v${VERSION} does not exist, proceeding with release"
|
||||
echo "should-release=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
build:
|
||||
needs: check-version-change
|
||||
if: needs.check-version-change.outputs.should-release == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build library packages
|
||||
run: |
|
||||
bin/package_libs
|
||||
|
||||
- name: Build all packages
|
||||
run: |
|
||||
bin/package_all
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-artifacts
|
||||
path: out/*.tar.gz
|
||||
|
||||
create-release:
|
||||
needs: [check-version-change, build]
|
||||
if: needs.check-version-change.outputs.should-release == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-artifacts
|
||||
path: artifacts
|
||||
|
||||
- name: Create Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION="${{ needs.check-version-change.outputs.version }}"
|
||||
|
||||
# Verify setup scripts exist
|
||||
for script in bin/breezy_gnome_setup bin/breezy_kwin_setup bin/breezy_vulkan_setup; do
|
||||
if [ ! -f "$script" ]; then
|
||||
echo "Error: $script not found"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Create a tag
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -a "v${VERSION}" -m "Release v${VERSION}"
|
||||
git push origin "v${VERSION}"
|
||||
|
||||
# Create release with artifacts
|
||||
gh release create "v${VERSION}" \
|
||||
--title "Release v${VERSION}" \
|
||||
--generate-notes \
|
||||
artifacts/* \
|
||||
bin/breezy_gnome_setup \
|
||||
bin/breezy_kwin_setup \
|
||||
bin/breezy_vulkan_setup
|
||||
Loading…
Reference in New Issue