Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 45 additions & 39 deletions .github/workflows/pack_mod.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
# This is a basic workflow to help you get started with Actions

name: Create-release

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- main
tags:
- '*'
- v**
pull_request:
branches:
- main

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
validate-mod:
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
env:
MOD_NAME: megapack_improved_dev
RELEASE_NAME: megapack_improved
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Install 7zip
run: sudo apt install p7zip-full

# Runs a set of commands using the runners shell
- name: Create mod archive
run: |
modname="megapack_improved_$(git tag)"
mv megapack_improved_dev/megapack_improved_dev.xml "megapack_improved_dev/$modname.xml"
mv megapack_improved_dev/ "$modname/"
7z a -t7z "$modname.7z" "$modname/"

- name: Upload To Github Release
# You may pin to the exact commit or the version.
# uses: xresloader/upload-to-github-release@98857380fc282f8075a62c6af230fe92bd93aff8
uses: xresloader/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# 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.
file: "*.7z"
overwrite: true
tags: true
update_latest_release: true

- uses: actions/checkout@v3

- if: ${{ github.ref_type == 'tag' }}
run: |
MOD_VERSION=${{ github.ref_name }}
echo "MOD_VERSION=${MOD_VERSION:1}" >> $GITHUB_ENV
- uses: megaglest/gh-action-validate-megaglest-mod@v1
with:
name: ${{ env.MOD_NAME }}
release_name: ${{ env.RELEASE_NAME }}
type: tech
directory: ${{ env.MOD_NAME }}

- if: ${{ github.ref_type == 'tag' }}
name: Make 7z and sha256sum
run: |
OUT_FILE="$RELEASE_NAME-$MOD_VERSION"
cd output/$RELEASE_NAME
sudo mv $RELEASE_NAME.xml "$OUT_FILE".xml
cd ..
sudo mv "$RELEASE_NAME" "$OUT_FILE"
7z a "$OUT_FILE.7z" "$OUT_FILE"
sudo rm -rf "$OUT_FILE"
sha256sum "$OUT_FILE.7z" > "$OUT_FILE.7z.sha256sum"

- if: ${{ github.ref_type == 'tag' }}
name: Release Mod
uses: ncipollo/release-action@v1
with:
allowUpdates: True
prerelease: False
artifacts: "output/${{ env.RELEASE_NAME }}*.*"
token: ${{ secrets.GITHUB_TOKEN }}
omitNameDuringUpdate: True
omitBodyDuringUpdate: True