diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 3c7ff1a..b2a4843 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -12,6 +12,16 @@ on: required: false type: string default: git.qlic.nl/qlic/deploy:php8.3-node22 + node-package-manager: + required: false + type: string + frontend-directory: + required: false + type: string + composer-args: + required: false + type: string + default: --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --ignore-platform-reqs username: required: false type: string @@ -25,25 +35,49 @@ jobs: deploy: runs-on: ubuntu-24.04 container: - image: git.qlic.nl/qlic/deploy:php8.3-node22 + image: ${{ inputs.image }} credentials: username: ${{ inputs.username }} password: ${{ inputs.password }} steps: - name: Checkout code uses: actions/checkout@v4 - - uses: webfactory/ssh-agent@dc588b651fe13675774614f8e6a936a468676387 - with: - ssh-private-key: ${{ secrets.ssh-private-key }} + - name: Setup composer uses: https://git.qlic.nl/actions/setup-composer@main with: - args: --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --ignore-platform-reqs + args: ${{ inputs.composer-args }} + - name: Create .env file from secret run: echo "${{ secrets.env }}" > .env + + - name: Build + if: ${{ inputs.node-package-manager }} + run: | + if [ -n "${{ inputs.frontend-directory }}" ]; then + cd ${{ inputs.frontend-directory }} + fi + + if [ "${{ inputs.node-package-manager }}" == "npm" ]; then + ${{ inputs.node-package-manager }} ci + elif [ "${{ inputs.node-package-manager }}" == "pnpm" ] || [ "${{ inputs.node-package-manager }}" == "yarn" ]; then + ${{ inputs.node-package-manager }} install --frozen-lockfile + fi + + if [ "${{ inputs.node-package-manager }}" != "none" ] && [ -n "${{ inputs.node-package-manager }}" ]; then + ${{ inputs.node-package-manager }} run build + fi + + + - name: Set up SSH agent + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.ssh-private-key }} + - name: Disable strict host key checking run: | echo "Host *" >> ~/.ssh/config echo " StrictHostKeyChecking no" >> ~/.ssh/config + - name: Deploy - run: vendor/bin/dep deploy environment=production \ No newline at end of file + run: vendor/bin/dep deploy environment=production