Skip to content

Publish App

Publish App #67

Workflow file for this run

name: Publish App
on:
workflow_dispatch:
schedule:
# Runs "at 00:00 on day-of-month 1" (see https://crontab.guru)
- cron: '0 0 1 * *'
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
target: 'aarch64-apple-darwin'
- platform: 'macos-latest'
target: 'x86_64-apple-darwin'
- platform: 'ubuntu-latest'
target: 'x86_64-unknown-linux-gnu'
- platform: 'windows-latest'
target: 'x86_64-pc-windows-msvc'
- platform: 'windows-latest'
target: 'aarch64-pc-windows-msvc'
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('tauri/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Pull gh-pages from github
working-directory: ./tauri
run: |
git clone -b gh-pages --depth 1 https://github.com/railmapgen/railmapgen.github.io.git ui
cd ui
git clone -b gh-pages --depth 1 https://github.com/railmapgen/rmg.git
git clone -b gh-pages --depth 1 https://github.com/railmapgen/rmg-palette.git
git clone -b gh-pages --depth 1 https://github.com/railmapgen/rmg-templates.git
git clone -b gh-pages --depth 1 https://github.com/railmapgen/rmp.git
git clone -b gh-pages --depth 1 https://github.com/railmapgen/rmp-gallery.git
git clone -b gh-pages --depth 1 https://github.com/railmapgen/rmp-designer.git
git clone -b gh-pages --depth 1 https://github.com/railmapgen/rma.git
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Get date
run: python -c "from datetime import date;import os;f=open(os.getenv('GITHUB_ENV'), 'a');f.write('date='+date.today().strftime('%Y%m%d'));f.close()"
- name: Use date as version in tauri's package
working-directory: ./tauri
run: |
python -c "from datetime import date;import json;
f=open('tauri.conf.json', 'r+');
conf=json.load(f);
d=date.today()
conf['version']=f'{d.year-2000}.{d.month}.{d.day}';
f.seek(0);
json.dump(conf,f,indent=2);
f.truncate();
f.close()"
- name: Update instance in info.json
working-directory: ./tauri
run: |
python -c "import json;
f=open('ui/info.json', 'r+');info=json.load(f);info['instance']='Tauri';f.seek(0);json.dump(info,f,indent=2);f.truncate();f.close();
f=open('ui/rmg/info.json', 'r+');info=json.load(f);info['instance']='Tauri';f.seek(0);json.dump(info,f,indent=2);f.truncate();f.close();
f=open('ui/rmg-palette/info.json', 'r+');info=json.load(f);info['instance']='Tauri';f.seek(0);json.dump(info,f,indent=2);f.truncate();f.close();
f=open('ui/rmg-templates/info.json', 'r+');info=json.load(f);info['instance']='Tauri';f.seek(0);json.dump(info,f,indent=2);f.truncate();f.close();
f=open('ui/rmp/info.json', 'r+');info=json.load(f);info['instance']='Tauri';f.seek(0);json.dump(info,f,indent=2);f.truncate();f.close();
f=open('ui/rmp-gallery/info.json', 'r+');info=json.load(f);info['instance']='Tauri';f.seek(0);json.dump(info,f,indent=2);f.truncate();f.close();
f=open('ui/rmp-designer/info.json', 'r+');info=json.load(f);info['instance']='Tauri';f.seek(0);json.dump(info,f,indent=2);f.truncate();f.close();
f=open('ui/rma/info.json', 'r+');info=json.load(f);info['instance']='Tauri';f.seek(0);json.dump(info,f,indent=2);f.truncate();f.close();"
- name: Get versions of each project
run: |
python3 -c "import urllib.request;import json;import os;
railmapgen=json.loads(urllib.request.urlopen('https://railmapgen.github.io/info.json').read())['version'];
rmg=json.loads(urllib.request.urlopen('https://railmapgen.github.io/rmg/info.json').read())['version'];
rmg_palette=json.loads(urllib.request.urlopen('https://railmapgen.github.io/rmg-palette/info.json').read())['version'];
rmg_templates=json.loads(urllib.request.urlopen('https://railmapgen.github.io/rmg-templates/info.json').read())['version'];
rmp=json.loads(urllib.request.urlopen('https://railmapgen.github.io/rmp/info.json').read())['version'];
rmp_gallery=json.loads(urllib.request.urlopen('https://railmapgen.github.io/rmp-gallery/info.json').read())['version'];
rmp_designer=json.loads(urllib.request.urlopen('https://railmapgen.github.io/rmp-designer/info.json').read())['version'];
rma=json.loads(urllib.request.urlopen('https://railmapgen.github.io/rma/info.json').read())['version'];
f=open(os.getenv('GITHUB_ENV'), 'a');
f.write(f'railmapgen={railmapgen}\n');
f.write(f'rmg={rmg}\n');
f.write(f'rmg_palette={rmg_palette}\n');
f.write(f'rmg_templates={rmg_templates}\n');
f.write(f'rmp={rmp}\n');
f.write(f'rmp_gallery={rmp_gallery}\n');
f.write(f'rmp_designer={rmp_designer}\n');
f.write(f'rma={rma}\n');
f.close()"
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: tauri-${{ env.date }}
releaseName: Rail Map Toolkit Desktop Application ${{ env.date }}
releaseBody: |
This application bundles all necessary resources into a single executable file, providing a seamless and self-contained experience whether you're offline or behind restrictive networks.
Beyond fundamental access, it unlocks extra features, including enhanced large image rendering capabilities leveraging native architecture support for improved performance. Please note that some advanced features may require a subscription to access.
This is built and published automatically, see the following table for the version of each component.
| Component | Version |
|--------------------|--------------------------|
|railmapgen.github.io|`${{ env.railmapgen }}` |
|rmg |`${{ env.rmg }}` |
|rmg-palette |`${{ env.rmg_palette }}` |
|rmg-templates |`${{ env.rmg_templates }}`|
|rmp |`${{ env.rmp }}` |
|rmp-gallery |`${{ env.rmp_gallery }}` |
|rmp-designer |`${{ env.rmp_designer }}` |
|rma |`${{ env.rma }}` |
releaseDraft: false
prerelease: false
args: --target ${{ matrix.target }}