-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,35 @@ | ||
name: Create Release | ||
name: C/C++ CI | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
permissions: | ||
contents: write | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
release: | ||
name: Release pushed tag | ||
build-and-release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up environment | ||
run: | | ||
echo "DATE_TAG=$(date +'%Y.%m.%d')" >> $GITHUB_ENV | ||
echo "RELEASE_COUNT=1" >> $GITHUB_ENV | ||
- name: Check for existing releases | ||
id: check_releases | ||
run: | | ||
existing_releases=$(gh release list --json tagName -q '.[].tagName' | grep -E '^v' | grep "$DATE_TAG") | ||
echo "EXISTING_RELEASES=${existing_releases}" >> $GITHUB_ENV | ||
- name: Determine new release tag | ||
run: | | ||
if [[ -n "$EXISTING_RELEASES" ]]; then | ||
latest_tag=$(echo "$EXISTING_RELEASES" | sort -V | tail -n 1) | ||
latest_number=$(echo "$latest_tag" | awk -F. '{print $NF}') | ||
NEW_TAG="v$DATE_TAG.$((latest_number + 1))" | ||
else | ||
NEW_TAG="v$DATE_TAG.$RELEASE_COUNT" | ||
fi | ||
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV | ||
echo "Creating release with tag: $NEW_TAG" | ||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh release create "$NEW_TAG" \ | ||
--repo="$GITHUB_REPOSITORY" \ | ||
--title="${NEW_TAG#v}" \ | ||
--generate-notes | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
/var/cache/apt/archives | ||
key: ${{ runner.os }}-apt-${{ hashFiles('**/Makefile') }} | ||
restore-keys: | | ||
${{ runner.os }}-apt- | ||
- name: Install dependencies | ||
run: sudo apt-get update && sudo apt-get upgrade -y && sudo apt install -y libconfig-dev libdbus-1-dev libegl-dev libev-dev libgl-dev libepoxy-dev libpcre2-dev libpixman-1-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-damage0-dev libxcb-dpms0-dev libxcb-glx0-dev libxcb-image0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-util-dev libxcb-xfixes0-dev libxext-dev meson ninja-build uthash-dev cmake libxft-dev libimlib2-dev libxinerama-dev libxcb-res0-dev alsa-utils | ||
|
||
- name: Clean Previous Build | ||
run: make clean | ||
|
||
- name: Build | ||
run: make | ||
continue-on-error: true | ||
|
||
- name: Check Build Failure | ||
if: ${{ failure() }} | ||
run: echo "Build failed. Investigate the logs for details." && exit 1 |