Skip to content

Commit

Permalink
Update build-and-deploy-dwm.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
fam007e authored Sep 20, 2024
1 parent ee44826 commit dd396ea
Showing 1 changed file with 28 additions and 42 deletions.
70 changes: 28 additions & 42 deletions .github/workflows/build-and-deploy-dwm.yml
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

0 comments on commit dd396ea

Please sign in to comment.