release for factorio 2.0 #227
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: Publish Version | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Code | |
# For push events: When configuring actions/checkout, make sure to set fetch-depth to either 0 or 2, depending on your use case. | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: changelog.txt | |
- name: Get latest version from changelog | |
if: ${{ steps.changed-files.outputs.any_modified == 'true' }} | |
id: get-version | |
run: | | |
VERSION=$(awk '/Version:/ {print $2; exit}' changelog.txt) | |
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
- name: Set latest version in version file | |
if: ${{ steps.changed-files.outputs.any_modified == 'true' && steps.get-version.outputs.version != 'unreleased' }} | |
run: | | |
jq '.version = "${{ steps.get-version.outputs.version }}"' info-template.json > info.json | |
- name: Make build folder | |
if: ${{ steps.changed-files.outputs.any_modified == 'true' && steps.get-version.outputs.version != 'unreleased' }} | |
run: mkdir tycoon | |
- name: Copy files into build folder | |
if: ${{ steps.changed-files.outputs.any_modified == 'true' && steps.get-version.outputs.version != 'unreleased' }} | |
run: | | |
cp -R graphics tycoon/ | |
cp -R locale tycoon/ | |
cp -R migrations tycoon/ | |
cp -R sound tycoon/ | |
cp *.lua tycoon/ | |
cp info.json tycoon/ | |
cp thumbnail.png tycoon/ | |
cp -R prototypes tycoon/ | |
cp changelog.txt tycoon/ | |
- name: Create a zip file | |
if: ${{ steps.changed-files.outputs.any_modified == 'true' && steps.get-version.outputs.version != 'unreleased' }} | |
uses: montudor/action-zip@v1 | |
with: | |
args: zip -r tycoon.zip tycoon | |
- name: Set up Python | |
if: ${{ steps.changed-files.outputs.any_modified == 'true' && steps.get-version.outputs.version != 'unreleased' }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Publish version | |
if: ${{ steps.changed-files.outputs.any_modified == 'true' && steps.get-version.outputs.version != 'unreleased' }} | |
run: | | |
python -m pip install requests | |
python upload.py | |
env: | |
MOD_UPLOAD_API_KEY: ${{ secrets.MOD_UPLOAD_API_KEY }} | |
MOD_UPLOAD_NAME: tycoon | |
MOD_UPLOAD_FILE: tycoon.zip | |
- name: Create tag | |
if: ${{ steps.changed-files.outputs.any_modified == 'true' && steps.get-version.outputs.version != 'unreleased' }} | |
run: | | |
git tag ${{ steps.get-version.outputs.version }} | |
git push --tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |