-
Notifications
You must be signed in to change notification settings - Fork 18
132 lines (125 loc) · 4.12 KB
/
main.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: main
on:
push:
tags:
- 'v*'
env:
PROJECT_ID: "518606"
jobs:
modpack-info:
runs-on: ubuntu-latest
outputs:
projectname: ${{ steps.info.outputs.projectname }}
version: ${{ steps.info.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get modpack info
id: info
run: |
manifestjson=`cat ./modpack/manifest.json`
projectname=`echo $(jq -r '.name' <<< "$manifestjson")`
echo "::set-output name=projectname::$projectname"
version=`echo $(jq -r '.minecraft.version' <<< "$manifestjson")`
echo "::set-output name=version::$version"
- name: Get tag
id: version
uses: "WyriHaximus/github-action-get-previous-tag@v1"
changelog:
runs-on: ubuntu-latest
outputs:
changelog: ${{ steps.changelog.outputs.changelog }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v1.0.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Write changelog to file
run: echo '${{ steps.changelog.outputs.changelog }}' > CHANGELOG.md
- name: Store changelog
uses: actions/upload-artifact@v2
with:
name: changelog
path: CHANGELOG.md
build:
runs-on: ubuntu-latest
needs: [changelog, modpack-info]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download PAX
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: froehlichA/pax
file: "pax"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download changelog
uses: actions/download-artifact@v2
with:
name: changelog
- name: Move changelog
run: mv ./CHANGELOG.md ./modpack/CHANGELOG.md
- name: Export modpack
run: |
sudo chmod +x ./pax
./pax export
- name: Rename zip
run: |
mv .out/${{ needs.modpack-info.outputs.projectname }}.zip .out/${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.tag }}.zip
- name: Upload zip
uses: actions/upload-artifact@v2
with:
name: modpack
path: .out/${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.tag }}.zip
release-github:
runs-on: ubuntu-latest
needs: [build, changelog, modpack-info]
steps:
- name: Download modpack
uses: actions/download-artifact@v2
with:
name: modpack
- name: Download changelog
uses: actions/download-artifact@v2
with:
name: changelog
- name: Create release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: ${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.tag }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-curseforge:
runs-on: ubuntu-latest
needs: [build, changelog, modpack-info]
steps:
- name: Download modpack
uses: actions/download-artifact@v2
with:
name: modpack
- name: Get release type
id: release-type
run: |
rel_type="release"
case "${{ needs.modpack-info.outputs.tag }}" in
*alpha*) rel_type="alpha" ;;
*beta*) rel_type="beta" ;;
*) rel_type="release" ;;
esac
echo "::set-output name=type::$rel_type"
- name: Create release
uses: itsmeow/curseforge-upload@v3
with:
token: ${{ secrets.CF_API_TOKEN }}
project_id: ${{ env.PROJECT_ID }}
game_endpoint: minecraft
file_path: ${{ needs.modpack-info.outputs.projectname }}-${{ needs.modpack-info.outputs.tag }}.zip
changelog: "${{ needs.changelog.outputs.changelog }}"
changelog_type: markdown
game_versions: ${{ needs.modpack-info.outputs.version }}
release_type: ${{ steps.release-type.outputs.type }}