updated workflow for compiling when release

This commit is contained in:
WanderingPenwing 2024-07-22 16:19:59 +02:00
parent 34dfaed030
commit 7be73ba7f9
5 changed files with 63 additions and 101 deletions

View file

@ -1,97 +0,0 @@
name: Deploy
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
jobs:
build-and-upload:
name: Build and upload
runs-on: ${{ matrix.os }}
strategy:
matrix:
# You can add more, for any target you'd like!
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl
- build: macos
os: macos-latest
target: x86_64-apple-darwin
- build: windows-gnu
os: windows-latest
target: x86_64-pc-windows-gnu
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libglib2.0-dev \
# Add any other dependencies needed by your project
- name: Debug PKG_CONFIG_PATH
run: echo "PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
- name: Set PKG_CONFIG_PATH
run: export PKG_CONFIG_PATH=/usr/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig
- name: Debug PKG_CONFIG_PATH
run: echo "PKG_CONFIG_PATH: $PKG_CONFIG_PATH"
- name: Install Rust
# Or @nightly if you want
uses: dtolnay/rust-toolchain@stable
# Arguments to pass in
with:
# Make Rust compile to our target (defined in the matrix)
targets: ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ matrix.target }}
- name: Build archive
shell: bash
run: |
# Replace with the name of your binary
binary_name="Calcifer"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
else
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
fi
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
else
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
fi
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.ASSET }}

57
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,57 @@
permissions:
contents: write
actions: read
checks: write
deployments: write
issues: write
packages: write
pull-requests: write
statuses: write
on:
release:
types: [created]
jobs:
release:
name: release ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [x86_64-pc-windows-gnu, x86_64-unknown-linux-musl]
steps:
- uses: actions/checkout@master
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Compile the app
run: |
cargo build --release --target ${{ matrix.target }}
- name: Create tarball
run: |
release_tag=${{ github.event.release.tag_name }}
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]]; then
tar -czvf calcifer_v${release_tag}.tar.gz -C target/${{ matrix.target }}/release calcifer
elif [[ "${{ matrix.target }}" == "x86_64-pc-windows-gnu" ]]; then
tar -czvf calcifer_windows_v${release_tag}.tar.gz -C target/${{ matrix.target }}/release calcifer.exe
fi
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: |
calcifer_v${{ github.event.release.tag_name }}.tar.gz
calcifer_windows_v${{ github.event.release.tag_name }}.tar.gz
asset_name: |
calcifer_v${{ github.event.release.tag_name }}.tar.gz
calcifer_windows_v${{ github.event.release.tag_name }}.tar.gz
asset_content_type: application/gzip

View file

@ -2,6 +2,7 @@
name = "calcifer" name = "calcifer"
version = "1.4.0" version = "1.4.0"
edition = "2021" edition = "2021"
build = "build/build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -16,6 +17,3 @@ nix = { version = "0.27.1", features = ["fs"] }
homedir = "0.2.1" homedir = "0.2.1"
arboard = "3.3.0" arboard = "3.3.0"
egui_dnd = "0.6.0" egui_dnd = "0.6.0"
[build]
rustflags = ["--cfg=web_sys_unstable_apis"]

4
build/build.rs Normal file
View file

@ -0,0 +1,4 @@
fn main() {
// custom parameter to fix clipboard issue between calcifer and external
println!("cargo:rustc-cfg=web_sys_unstable_apis");
}

View file

@ -1 +1 @@
{"categories":[{"name":"to do","content":[{"name":"bug project","description":"when switching tabs between two project file, if item window is open it crashes","id":1},{"name":"update workflow .yml","description":"make a workflow compiling the calcifer and put the linux in calcifer-{version}\nand the windows in calcifer_windows_{version}\n\nupdate nix\nupdate jiji","id":5}]},{"name":"in progress","content":[{"name":"export copy paste fix","description":"// Hello there","id":1}]},{"name":"done","content":[{"name":"move .project file","description":"// Hello there","id":4},{"name":"move config","description":"config from .calcifer/save.json\nto .config/calcifer/state.json","id":1},{"name":"add id to textarea per tab","description":"to improve undo, make each code area of each tab have a unique id (no more undo into another tab)","id":1},{"name":"file tree id ?","description":"// Hello there","id":1},{"name":"open dir in tree ?","description":"// Hello there","id":2},{"name":"fix tab title","description":"// Hello there","id":2}]},{"name":"+","content":[]}]} {"categories":[{"name":"to do","content":[{"name":"update workflow .yml","description":"make a workflow compiling the calcifer and put the linux in calcifer-{version}\nand the windows in calcifer_windows_{version}\n\nupdate nix\nupdate jiji","id":5}]},{"name":"in progress","content":[{"name":"export copy paste fix","description":"// Hello there","id":1}]},{"name":"done","content":[{"name":"move .project file","description":"// Hello there","id":4},{"name":"move config","description":"config from .calcifer/save.json\nto .config/calcifer/state.json","id":1},{"name":"add id to textarea per tab","description":"to improve undo, make each code area of each tab have a unique id (no more undo into another tab)","id":1},{"name":"file tree id ?","description":"// Hello there","id":1},{"name":"open dir in tree ?","description":"// Hello there","id":2},{"name":"fix tab title","description":"// Hello there","id":2}]},{"name":"+","content":[]}]}