|
1 | | -# This is a basic workflow to help you get started with Actions |
2 | | - |
3 | 1 | name: Create-release |
4 | 2 |
|
5 | | -# Controls when the workflow will run |
6 | 3 | on: |
7 | | - # Triggers the workflow on push or pull request events but only for the main branch |
8 | 4 | push: |
| 5 | + branches: |
| 6 | + - main |
9 | 7 | tags: |
10 | | - - '*' |
| 8 | + - v** |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
11 | 12 |
|
12 | | -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
13 | 13 | jobs: |
14 | | - # This workflow contains a single job called "build" |
15 | | - build: |
16 | | - # The type of runner that the job will run on |
| 14 | + validate-mod: |
17 | 15 | runs-on: ubuntu-latest |
18 | | - |
19 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
| 16 | + env: |
| 17 | + MOD_NAME: megapack_improved_dev |
| 18 | + RELEASE_NAME: megapack_improved |
20 | 19 | steps: |
21 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
22 | | - - uses: actions/checkout@v2 |
23 | | - |
24 | | - # Runs a single command using the runners shell |
25 | | - - name: Install 7zip |
26 | | - run: sudo apt install p7zip-full |
27 | | - |
28 | | - # Runs a set of commands using the runners shell |
29 | | - - name: Create mod archive |
30 | | - run: | |
31 | | - modname="megapack_improved_$(git tag)" |
32 | | - mv megapack_improved_dev/megapack_improved_dev.xml "megapack_improved_dev/$modname.xml" |
33 | | - mv megapack_improved_dev/ "$modname/" |
34 | | - 7z a -t7z "$modname.7z" "$modname/" |
35 | | -
|
36 | | - - name: Upload To Github Release |
37 | | - # You may pin to the exact commit or the version. |
38 | | - # uses: xresloader/upload-to-github-release@98857380fc282f8075a62c6af230fe92bd93aff8 |
39 | | - uses: xresloader/[email protected] |
40 | | - env: |
41 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
42 | | - with: |
43 | | - # The files or file patterns to upload. You can upload multiple files by split them by semicolon. You can use the glob pattern to find the files. |
44 | | - file: "*.7z" |
45 | | - overwrite: true |
46 | | - tags: true |
47 | | - update_latest_release: true |
48 | | - |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - if: ${{ github.ref_type == 'tag' }} |
| 23 | + run: | |
| 24 | + MOD_VERSION=${{ github.ref_name }} |
| 25 | + echo "MOD_VERSION=${MOD_VERSION:1}" >> $GITHUB_ENV |
| 26 | + - uses: megaglest/gh-action-validate-megaglest-mod@v1 |
| 27 | + with: |
| 28 | + name: ${{ env.MOD_NAME }} |
| 29 | + release_name: ${{ env.RELEASE_NAME }} |
| 30 | + type: tech |
| 31 | + directory: ${{ env.MOD_NAME }} |
| 32 | + |
| 33 | + - if: ${{ github.ref_type == 'tag' }} |
| 34 | + name: Make 7z and sha256sum |
| 35 | + run: | |
| 36 | + OUT_FILE="$RELEASE_NAME-$MOD_VERSION" |
| 37 | + cd output/$RELEASE_NAME |
| 38 | + sudo mv $RELEASE_NAME.xml "$OUT_FILE".xml |
| 39 | + cd .. |
| 40 | + sudo mv "$RELEASE_NAME" "$OUT_FILE" |
| 41 | + 7z a "$OUT_FILE.7z" "$OUT_FILE" |
| 42 | + sudo rm -rf "$OUT_FILE" |
| 43 | + cd output |
| 44 | + sha256sum "$OUT_FILE.7z" > "$OUT_FILE.7z.sha256sum" |
| 45 | +
|
| 46 | + - if: ${{ github.ref_type == 'tag' }} |
| 47 | + name: Release Mod |
| 48 | + uses: ncipollo/release-action@v1 |
| 49 | + with: |
| 50 | + allowUpdates: True |
| 51 | + prerelease: False |
| 52 | + artifacts: "output/${{ env.RELEASE_NAME }}*.*" |
| 53 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + omitNameDuringUpdate: True |
| 55 | + omitBodyDuringUpdate: True |
0 commit comments