From d663ff529a811e5ba55e0743ca10746e1e789a7e Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 3 May 2021 20:15:37 +0200 Subject: [PATCH 1/3] Automatic release artifact generation --- .github/workflows/releases.yml | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/releases.yml diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml new file mode 100644 index 000000000..1a28578e9 --- /dev/null +++ b/.github/workflows/releases.yml @@ -0,0 +1,66 @@ +name: Generate release packages +on: [pull_request] +# release: +# types: [published] +jobs: + release: + name: Create release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + tools: pecl, composer:v1 + + - name: Retrieve version + id: release + run: echo "::set-output name=version::$(cat VERSION)" + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Get composer cache directory + id: composercache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --no-dev --optimize-autoloader + + - name: Create artifact + id: artifact + run: | + ARTIFACT="friendica-full-${{ steps.release.outputs.version }}.tar.gz" + echo "::set-output name=name::${ARTIFACT}" + mkdir build + tar -cvjf build/${ARTIFACT} -T mods/release-list.txt + + - name: SHA256 + id: sha256 + run: | + cd build + ARTIFACT=${{ steps.artifact.outputs.name }} + sha256sum "${ARTIFACT}" > "${ARTIFACT}.sha256" + echo "::set-output name=name::${ARTIFACT}.sha256" + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: friendica + path: build/ + + # - name: Upload to release + # uses: JasonEtco/upload-to-release@master + # with: + # args: build/friendica-full-${{ steps.release.outputs.version }}.tar.gz application/zip + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 64332c8c2b2d9a9bf543957ecd6c4540d5051ee7 Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 3 May 2021 20:17:30 +0200 Subject: [PATCH 2/3] Add release list --- mods/release-list.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 mods/release-list.txt diff --git a/mods/release-list.txt b/mods/release-list.txt new file mode 100644 index 000000000..dfebc0216 --- /dev/null +++ b/mods/release-list.txt @@ -0,0 +1,29 @@ +bin/auth_ejabberd.php +bin/console +bin/console.bat +bin/console.php +bin/daemon.php +bin/testargs.php +bin/worker.php +config/ +doc/ +images/ +include/ +mod/ +mods/ +spec/ +src/ +static/ +vendor/ +view/ +.htaccess-dist +boot.php +CHANGELOG +CREDITS.txt +database.sql +index.php +LICENSE +README.md +security.txt +update.php +VERSION \ No newline at end of file From ab6c0ede17163245e43445ba0e86e41453cdeaeb Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 3 May 2021 20:35:18 +0200 Subject: [PATCH 3/3] Enable workflow for releases only --- .github/workflows/releases.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 1a28578e9..9a7c544d9 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -1,7 +1,7 @@ name: Generate release packages -on: [pull_request] -# release: -# types: [published] +on: + release: + types: [published] jobs: release: name: Create release @@ -50,7 +50,6 @@ jobs: cd build ARTIFACT=${{ steps.artifact.outputs.name }} sha256sum "${ARTIFACT}" > "${ARTIFACT}.sha256" - echo "::set-output name=name::${ARTIFACT}.sha256" - name: Upload artifact uses: actions/upload-artifact@v2 @@ -58,9 +57,11 @@ jobs: name: friendica path: build/ - # - name: Upload to release - # uses: JasonEtco/upload-to-release@master - # with: - # args: build/friendica-full-${{ steps.release.outputs.version }}.tar.gz application/zip - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + - name: Upload to release + uses: softprops/action-gh-release@v1 + with: + files: | + build/${{ steps.artifact.outputs.name }}.tar.gz + build/${{ steps.artifact.outputs.name }}.tar.gz.sha256 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file