From 9446ad5e5410514d8019e1645e8f30e7638e9370 Mon Sep 17 00:00:00 2001 From: Akash6222 Date: Wed, 14 Feb 2024 03:16:42 +0530 Subject: [PATCH] Added release.yml --- .github/workflows/release.yml | 78 +++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..561bc5d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: Release + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + + permissions: + contents: write + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set current date as environment variable + run: echo "DATE=`date +'%Y.%m.%d'`" >>$GITHUB_ENV + + - name: Building TCET Linux Gnome settings Tar file + run: | + cd .. + touch tcet-linux-gnome-settings.tar.gz + tar -czf tcet-linux-gnome-settings.tar.gz tcet-linux-gnome-settings/ + touch checksum + sha256sum tcet-linux-gnome-settings.tar.gz > checksum + mv checksum tcet-linux-gnome-settings/ + mv tcet-linux-gnome-settings.tar.gz tcet-linux-gnome-settings/ + + - name: Checking if release with date tag exist + run: | + tag=${{ env.DATE }} + if gh release view $tag; then + echo "RELEASE_EXISTS=true" >> $GITHUB_ENV + else + echo "RELEASE_EXISTS=false" >> $GITHUB_ENV + fi + + - name: Checking if release with latest tag exist + run: | + tag=latest + if gh release view $tag; then + echo "LATEST_RELEASE_EXISTS=true" >> $GITHUB_ENV + else + echo "LATEST_RELEASE_EXISTS=false" >> $GITHUB_ENV + fi + + - name: Deleting Dated release + if: env.RELEASE_EXISTS == 'true' + run: | + gh release delete ${{ env.DATE }} + + - name: Delete Previous Latest release + if: env.LATEST_RELEASE_EXISTS == 'true' + run: | + gh release delete latest + - name: Release Tar File + run: | + gh release create ${{ env.DATE }} *tar.gz checksum --title "TCET-Linuxc Gnome settings" + - name: Release Tar File with latest + run: | + gh release create latest *tar.gz checksum --latest --title "TCET-Linux Gnome settings" + - name: Triggered PKGBUILD Action + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.PAT_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/tcet-opensource/tcet-linux-pkgbuild/dispatches \ + -d '{"event_type":"trigger-workflow","client_payload":{"unit":false,"integration":true}}'