diff options
author | Niklas Seyfarth <niklas@seyfarth.de> | 2021-06-03 21:15:26 +0300 |
---|---|---|
committer | Niklas Seyfarth <niklas@seyfarth.de> | 2021-06-11 10:58:44 +0300 |
commit | f1152346c1bf32cc631d4e9ecaabdd4a982e95ed (patch) | |
tree | df222bc2950b8ddb9acb08be5d455dfcfed668e2 /.github | |
parent | c57ca97fc4ee490ddcc95b2bd5f447b2e282093a (diff) |
Add package GitHub action.
Signed-off-by: Niklas Seyfarth <niklas@seyfarth.de>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/package.yml | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..d7d27dc --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,67 @@ +name: Package the app with krankerl +on: + pull_request: + types: [opened, synchronize, reopened] + release: + types: [published] + +env: + KRANKERL_VERSION: 0.13.1 + APP_NAME: twofactor_gateway + +jobs: + package: + runs-on: ubuntu-18.04 + steps: + - name: Checkout App + uses: actions/checkout@v2 + + - name: Setup PHP 7.2 + uses: shivammathur/setup-php@2.11.0 + with: + php-version: '7.2' + tools: composer + - name: Setup Node.js + uses: actions/setup-node@v2.1.5 + with: + node-version: '12' # dependency chokidar@2.1.8 will break with v14+ + + - name: Get cache directories + id: cache-dir + run: | + echo "::set-output name=composer::$(composer config cache-files-dir)" + echo "::set-output name=npm::$(npm config get cache)" + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.cache-dir.outputs.composer }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Cache npm dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.cache-dir.outputs.npm }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- + + - name: Install krankerl + run: | + wget https://github.com/ChristophWurst/krankerl/releases/download/v${KRANKERL_VERSION}/krankerl + sudo mv krankerl /usr/bin/krankerl + sudo chown root:root /usr/bin/krankerl + sudo chmod 755 /usr/bin/krankerl + + - name: Package app + run: krankerl package + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ env.APP_NAME }}.tar.gz + path: build/artifacts/${{ env.APP_NAME }}.tar.gz + - name: Attach artifact to release + uses: fnkr/github-action-ghr@v1 + if: startsWith(github.ref, 'refs/tags/') + env: + GHR_PATH: build/artifacts/${{ env.APP_NAME }}.tar.gz + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |