-
Notifications
You must be signed in to change notification settings - Fork 5
48 lines (41 loc) · 1.5 KB
/
pull-request.yml
File metadata and controls
48 lines (41 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Zip Repository on Pull Request
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write # Necessary permission to create releases and upload assets
jobs:
zip_and_prerelease:
runs-on: ubuntu-latest
env:
ORG_NAME: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
ZIP_NAME: ${{ github.repository_owner }}-${{ github.event.repository.name }}.zip
PR_NUMBER: ${{ github.event.number }}
BRANCH_NAME: ${{ github.head_ref }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Create zip archive
shell: bash
run: |
echo "Organization Name: $ORG_NAME"
echo "Repository Name: $REPO_NAME"
echo "Pull Request Number: $PR_NUMBER"
echo "Branch Name: $BRANCH_NAME"
echo "Zip File Name: $ZIP_NAME"
# Exclude .py files and other specified patterns
zip -r "$ZIP_NAME" ./* -x "*.py"
- name: Create Prerelease and Upload Zip
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: "pr-${{ env.PR_NUMBER }}-${{ github.event.pull_request.head.sha }}"
releaseName: "Prerelease ${{ env.BRANCH_NAME }} PR #${{ env.PR_NUMBER }}"
artifacts: ${{ env.ZIP_NAME }}
artifactContentType: application/zip
draft: false
prerelease: true
overwrite: true # Overwrite release if it already exists