Skip to content

Commit

Permalink
update 7.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
amamic1803 committed Jan 13, 2024
1 parent d3d1bec commit 28a7144
Show file tree
Hide file tree
Showing 3 changed files with 350 additions and 306 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Release

on:
workflow_dispatch:

permissions:
contents: write
discussions: write
packages: read

jobs:
build-windows:
name: Build (Windows)
runs-on: windows-latest
defaults:
run:
shell: bash

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Rust
run: rustup update

- name: Install requirements
run: pip install -r requirements.txt

- name: Install UPX
uses: crazy-max/ghaction-upx@v2
with:
install-only: true

- name: Get name and version
id: get_info
run: |
NAME=$(python build.py --name)
VERSION=$(python build.py --version)
echo "NAME=${NAME}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Package binary
run: |
maturin develop --release
python build.py
- name: Rename binary
run: mv "${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}.exe" "${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}-win-x86_64.exe"

- uses: actions/upload-artifact@v3
name: Upload binary artifact
with:
name: windows-binary
retention-days: 3
path: "${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}-win-x86_64.exe"

publish-release:
name: Publish GitHub release
runs-on: ubuntu-latest
needs: build-windows
defaults:
run:
shell: bash

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Rust
run: rustup update

- name: Install requirements
run: pip install -r requirements.txt

- name: Get name and version
id: get_info
run: |
NAME=$(python build.py --name)
VERSION=$(python build.py --version)
echo "NAME=${NAME}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Create binary folders
run: mkdir -p windows-binary

- name: Download Windows binary
uses: actions/download-artifact@v3
with:
name: windows-binary
path: windows-binary

- uses: mukunku/tag-exists-action@v1.2.0
name: Check if this version was already released
id: checkTag
with:
tag: 'v${{ steps.get_info.outputs.VERSION }}'

- name: Terminate if this version was already released
if: steps.checkTag.outputs.exists == 'true'
run: |
echo "v${{ steps.get_info.outputs.VERSION }} was already released!" >&2
exit 1
- name: Create release
uses: softprops/action-gh-release@v1
with:
body: |
### **_${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}_**
draft: false
prerelease: false
files: |
windows-binary/${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}-win-x86_64.exe
name: v${{ steps.get_info.outputs.VERSION }}
tag_name: v${{ steps.get_info.outputs.VERSION }}
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 2048
A recreation of 2048 game
A simple 2048 game written in Rust and Python

![screenshot v7.0.0](https://user-images.githubusercontent.com/40371578/227711149-07d734d7-128b-45d7-b0b4-97bc175eca38.png)

Expand All @@ -8,8 +8,8 @@ Prebuilt program is available under Releases

## Building
1. Clone repository
2. Have the latest Python 3 installed
3. Have the latest Rust installed (with cargo in PATH) (not needed for Windows x64 -> just change compile_rust to False in build.py)
4. Run command: `pip install -r requirements.txt`
2. Install Python
3. Install Rust
4. Install dependencies: `pip install -r requirements.txt`
5. Run build.py
6. Built `*.exe` will be placed in the same folder
Loading

0 comments on commit 28a7144

Please sign in to comment.