-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.78 KB
/
make_mcpack.yml
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
49
50
51
52
53
54
55
56
57
58
59
name: Create Release Asset
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag'
required: true
default: 'v1.0.0'
jobs:
release:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository code
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Prompt for the tag (using input from workflow_dispatch)
- name: Get release tag
id: get_tag
run: echo "Release Tag: ${{ github.event.inputs.tag }}"
# Step 3: Create a zip of the current repository excluding .git and .github
- name: Zip repository excluding .git and .github
run: |
zip -r oreui-utilities.zip . -x "*.git*" -x ".github/*"
# Step 4: Check if the release already exists
- name: Check if tag exists and create the tag if it doesn't
id: check_tag
run: |
TAG=${{ github.event.inputs.tag }}
git fetch --tags
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists."
else
echo "Tag $TAG does not exist. Creating tag."
git tag $TAG
git push origin $TAG
fi
# Step 5: Create the release and upload the asset
- name: Create Release and Upload Asset
run: |
TAG=${{ github.event.inputs.tag }}
# Create release if it doesn't exist
RELEASE=$(gh release view $TAG --json name --jq '.name' || echo "none")
if [[ "$RELEASE" == "none" ]]; then
echo "Creating release $TAG"
gh release create "$TAG" oreui-utilities.zip --title "Release $TAG" --notes "Automated release for $TAG" --latest
else
echo "Release $TAG already exists"
fi
# Step 6: Logout from GitHub CLI
- name: Logout from GitHub CLI
run: gh auth logout -y