Skip to content

ci: Update actions #221

ci: Update actions

ci: Update actions #221

Workflow file for this run

# This file lints the code, runs tests, builds a package and then deploys it.
# The following secrets need to be set:
# - “CLOUDSMITH_API_KEY” for pushing built package to Cloudsmith
name: CI
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v25
- name: Set outputs
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Install dependencies
run: nix-shell --run 'composer install --no-interaction'
- name: Check code using Nette code checker
run: nix-shell --run 'code-checker -d app'
- name: Lint coding style
run: nix-shell --run 'composer run-script cs'
- name: Run static analysis
run: nix-shell --run 'composer run-script phpstan'
- name: Lint source code
run: nix-shell --run 'composer run-script lint'
- name: Run tests
run: |
cp .github/workflows/private.neon app/Config/private.neon
nix-shell --run 'composer test'
- name: Build a zipball
run: nix-shell --run 'npm run dist "entries-${{ steps.vars.outputs.sha_short }}.zip"'
- name: Upload the zipball to GitHub
uses: actions/upload-artifact@v4
with:
name: entries-${{ steps.vars.outputs.sha_short }}.zip
if-no-files-found: error
path: entries-${{ steps.vars.outputs.sha_short }}.zip
- name: Upload the zipball to Cloudsmith
uses: cloudsmith-io/action@v0.5.3
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
format: "raw"
owner: "entries-for-rogaining"
repo: "entries"
file: entries-${{ steps.vars.outputs.sha_short }}.zip
name: entries.zip
version: ${{ steps.vars.outputs.sha_short }}
extra: '--tags version:latest'