Package the mod ourselves #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check & Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
package: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Package details | |
id: package_details | |
shell: bash | |
run: | | |
echo "name=$(jq -r .name info.json)" >> $GITHUB_OUTPUT | |
echo "version=$(jq -r .version info.json)" >> $GITHUB_OUTPUT | |
- name: Create Package | |
shell: bash | |
run: | | |
mkdir -p build | |
tar cf build/package.tar \ | |
--transform 's|./|${{ steps.package_details.outputs.name }}-${{ steps.package_details.outputs.version }}/|' \ | |
--exclude '.git' --exclude '.github' --exclude 'dist' --exclude 'build' \ | |
--exclude 'tools' \ | |
. | |
mkdir -p dist | |
( | |
cd build; zip -r \ | |
../dist/${{ steps.package_details.outputs.name }}-${{ steps.package_details.outputs.version }} \ | |
${{ steps.package_details.outputs.name }}-${{ steps.package_details.outputs.version }}/ | |
) | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: Package | |
if-no-files-found: error | |
path: "dist/*.zip" | |
release-github: | |
runs-on: ubuntu-latest | |
needs: [package] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Create Factorio mod package | |
uses: Roang-zero1/factorio-mod-package@master | |
- name: Create GitHub release | |
uses: Roang-zero1/github-create-release-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
UPDATE_EXISTING: "true" | |
VERSION_REGEX: ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ | |
- name: Tag Filter | |
uses: actions/bin/filter@3c0b4f0e63ea54ea5df2914b4fabf383368cd0da | |
with: | |
args: tag | |
- name: Upload GitHub artifacts | |
uses: Roang-zero1/github-upload-release-artifacts-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: dist/ | |
release-modportal: | |
runs-on: ubuntu-latest | |
needs: [package] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Create Factorio mod package | |
uses: Roang-zero1/factorio-mod-package@master | |
- name: Factorio release | |
uses: Roang-zero1/factorio-create-release-action@master | |
with: | |
factorio_password: ${{ secrets.FACTORIO_PASSWORD }} | |
factorio_user: ${{ secrets.FACTORIO_USER }} |