From 3242b8fc1de730d4e0323c9c645251ac296e4c3d Mon Sep 17 00:00:00 2001 From: turegjorup Date: Tue, 29 Jul 2025 11:00:13 +0200 Subject: [PATCH] Add build release job to github actions --- .github/workflows/build_release.yml | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/build_release.yml diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml new file mode 100644 index 0000000..f3881b1 --- /dev/null +++ b/.github/workflows/build_release.yml @@ -0,0 +1,48 @@ +on: + push: + tags: + - "*.*.*" + +name: Create Github Release + +permissions: + contents: write + +env: + COMPOSE_USER: runner + +jobs: + create-release: + runs-on: ubuntu-latest + env: + COMPOSER_ALLOW_SUPERUSER: 1 + APP_ENV: prod + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Composer install + run: | + docker network create frontend + docker compose run --rm --user=root -e APP_ENV=prod phpfpm composer install --no-dev --optimize-autoloader + docker compose run --rm --user=root -e APP_ENV=prod phpfpm composer clear-cache + + - name: Make assets dir + run: | + mkdir -p ../assets + + - name: Create archive + run: | + sudo chown -R runner:runner ./ + tar --exclude='.git' -zcf ../assets/${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz ./ + + - name: Create checksum + run: | + cd ../assets + sha256sum ${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz > ../assets/checksum.txt + + - name: Create a release in GitHub and uploads assets + run: gh release create ${{ github.ref_name }} --verify-tag --generate-notes ../assets/*.* + env: + GITHUB_TOKEN: ${{ github.TOKEN }} + shell: bash