Skip to content

Commit

Permalink
added PR upload action
Browse files Browse the repository at this point in the history
  • Loading branch information
hansmorb committed Mar 18, 2024
1 parent 3185b24 commit 00c87f8
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/actions/build-plugin/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: 'Build Plugin'
description: 'Builds plugin into ./build/commonsbooking'

inputs:
generate_zip:
description: 'Set to true, if a zip file should be generated in the root of the plugin folder'
required: false
default: 'false'
options:
- true
- false

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -30,6 +39,12 @@ runs:
- run: npm ci --legacy-peer-deps --include=dev
shell: bash

- name: Run build script
- name: Run build script (skip zip generation)
if: ${{ inputs.generate_zip == 'false' }}
run: bin/build-zip.sh --skip-zip
shell: bash
shell: bash

- name: Run build script and generate zip file
if: ${{ inputs.generate_zip == 'true' }}
run: bin/build-zip.sh
shell: bash
40 changes: 40 additions & 0 deletions .github/workflows/zip-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build zip from PR
on:
pull_request:
branches: [ master ]

jobs:
zip-rc:
runs-on: ubuntu-20.04
steps:

- uses: actions/checkout@v4

- uses: ./.github/actions/build-plugin
with:
generate_zip: 'true'

- name: Upload zip
uses: Dylan700/sftp-upload-action@latest
with:
server: ${{ secrets.CBZIPUPLOAD_HOST }}
username: ${{ secrets.CBZIPUPLOAD_USER }}
key: ${{ secrets.CBZIPUPLOAD_KEY }}
uploads: |
./ => ./cbzip/${{ github.event.number }}/
ignore: |
!commonsbooking.zip
- name: Comment on PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let issue_number = ${{ github.event.number }};
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: '[Download zip](http://cbzip.v2202011131270131895.happysrv.de/${{ github.event.number}}/commonsbooking.zip'
});

0 comments on commit 00c87f8

Please sign in to comment.