From 9374424e5d898c13eaa2ba6dc8c47e31f05dc38a Mon Sep 17 00:00:00 2001 From: Jeremy Gao <145064583+WenSimEHRP@users.noreply.github.com> Date: Thu, 5 Sep 2024 02:13:50 -0700 Subject: [PATCH] Add: GitHub workflow --- .editorconfig | 4 +++ .github/workflows/build.yml | 67 +++++++++++++++++++++++++++++++++++++ Justfile | 1 - 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.editorconfig b/.editorconfig index 76cdb63..05f2aa1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,3 +11,7 @@ end_of_line = lf [Makefile] indent_style = tab + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..531a991 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,67 @@ +name: Build Station + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.12 + + - name: Install Scoop + shell: pwsh + run: | + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression + + - name: Install dependencies + shell: pwsh + run: | + scoop install just + just deps + + - name: Build Tracks + run: just + + - name: Pack Binaries + shell: pwsh + run: | + New-Item -ItemType Directory -Path release + Move-Item -Path china-set-tracks.grf -Destination release/ + + - name: Get Date + id: date + shell: pwsh + run: echo "RELEASE_DATE=$(Get-Date -Format 'yyyy-MM-dd')" >> $env:GITHUB_ENV + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.RELEASE_DATE }} + release_name: Release ${{ env.RELEASE_DATE }} + draft: false + prerelease: true + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./release/china-set-tracks.grf + asset_name: china-set-tracks.grf + asset_content_type: application/octet-stream diff --git a/Justfile b/Justfile index 2775d01..bb2292c 100644 --- a/Justfile +++ b/Justfile @@ -39,7 +39,6 @@ deps: scoop bucket add openttd-bucket https://github.com/wensimehrp/openttd-bucket scoop install openttd-bucket/gorender scoop install openttd-bucket/nml - scoop install mingw clean_png_dir dir: find ./vox/{{dir}} -name '*.png' -delete