Skip to content

Commit

Permalink
Release [Version 0.4.0]
Browse files Browse the repository at this point in the history
  • Loading branch information
Padi2312 committed Apr 12, 2024
2 parents f2dff44 + c300ae5 commit 0dbbdf7
Show file tree
Hide file tree
Showing 59 changed files with 1,522 additions and 1,534 deletions.
60 changes: 15 additions & 45 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,35 @@
name: Pre-release dorcs
name: Pre-release dorcs
on: workflow_dispatch

jobs:
build-and-upload:
name: Build and upload
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl

# - build: macos | # NOPE I DONT DO THIS. YOU'RE RICH ENOUGH TO DO IT YOURSELF.
# os: macos-latest
# target: x86_64-apple-darwin
os: [linux, windows]
goarch: [amd64] # Add more architectures if needed

- build: windows-gnu
os: ubuntu-latest
target: x86_64-pc-windows-gnu
steps:
- name: Checkout
uses: actions/checkout@v4

# Get version from cargo.toml
- name: Get version
id: get_version
run: echo "VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')" >> $GITHUB_ENV

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
# Make Rust compile to our target (defined in the matrix)
targets: ${{ matrix.target }}

- name: Install mingw-w64
if: matrix.build == 'windows-gnu'
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64 zip
version=$(grep -o 'var version = "[^"]*"' main.go | cut -d'"' -f2)
echo "VERSION=$version" >> $GITHUB_ENV
- name: Build
uses: actions-rs/cargo@v1
- name: Set up Go
uses: actions/setup-go@v3
with:
command: build
args: --verbose --release --target ${{ matrix.target }}
go-version: '1.22.2' # Use the Go version that your project requires

- name: Build archive
shell: bash
- name: Build
run: |
binary_name="dorcs"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
if [ "${{ matrix.build}}" = "windows-gnu" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname/$binary_name.exe"
echo "ASSET=$dirname/$binary_name.exe" >> $GITHUB_ENV
else
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname/$binary_name"
echo "ASSET=$dirname/$binary_name" >> $GITHUB_ENV
fi
go generate ./build/gen.go
GOOS=${{ matrix.os }} GOARCH=${{ matrix.goarch }} go build -o ${{ github.workspace }}/build/dorcs-${{ matrix.os }}-${{ matrix.goarch }}${{ matrix.os == 'windows' && '.exe' || '' }} main.go
echo "ASSET=${{ github.workspace }}/build/dorcs-${{ matrix.os }}-${{ matrix.goarch }}${{ matrix.os == 'windows' && '.exe' || '' }}" >> $GITHUB_ENV
- name: Tag commit
run: |
Expand All @@ -72,4 +42,4 @@ jobs:
files: |
${{ env.ASSET }}
tag_name: ${{ env.VERSION }}
prerelease: true
prerelease: true
62 changes: 20 additions & 42 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,51 @@ on:
push:
branches:
- main

jobs:
build-and-upload:
name: Build and upload
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl

# - build: macos | # NOPE I DONT DO THIS. YOU'RE RICH ENOUGH TO DO IT YOURSELF.
# os: macos-latest
# target: x86_64-apple-darwin
os: [linux, windows]
goarch: [amd64] # Add more architectures if needed

- build: windows-gnu
os: ubuntu-latest
target: x86_64-pc-windows-gnu
steps:
- name: Checkout
uses: actions/checkout@v4

# Get version from cargo.toml
- name: Get version
id: get_version
run: echo "VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')" >> $GITHUB_ENV
run: |
version=$(grep -o 'var version = "[^"]*"' main.go | cut -d'"' -f2)
echo "VERSION=$version" >> $GITHUB_ENV
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up Go
uses: actions/setup-go@v3
with:
# Make Rust compile to our target (defined in the matrix)
targets: ${{ matrix.target }}

- name: Install mingw-w64
if: matrix.build == 'windows-gnu'
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64 zip
go-version: '1.22.2' # Use the Go version that your project requires

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --release --target ${{ matrix.target }}
run: |
GOOS=${{ matrix.os }} GOARCH=${{ matrix.goarch }} go build -o ${{ github.workspace }}/build/dorcs-${{ matrix.os }}-${{ matrix.goarch }}${{ matrix.os == 'windows' && '.exe' || '' }} main.go
- name: Build archive
shell: bash
- name: Archive build
run: |
binary_name="dorcs"
binary_name=dorcs-${{ matrix.os }}-${{ matrix.goarch }}${{ matrix.os == 'windows' && '.exe' || '' }}
zip -j ${{ github.workspace }}/build/$binary_name.zip ${{ github.workspace }}/build/$binary_name
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
if [ "${{ matrix.build}}" = "windows-gnu" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname/$binary_name.exe"
echo "ASSET=$dirname/$binary_name.exe" >> $GITHUB_ENV
else
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname/$binary_name"
echo "ASSET=$dirname/$binary_name" >> $GITHUB_ENV
fi
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: dorcs-${{ matrix.os }}-${{ matrix.goarch }}
path: ${{ github.workspace }}/build/dorcs-${{ matrix.os }}-${{ matrix.goarch }}.zip

- name: Tag commit
run: |
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down
29 changes: 26 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
/target
*/target
output
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Executables
*.exe
*.out

# Go binary
/bin/

# Go build cache and test cache
/.cache/
/.testcache/

# Go test output
/test_output/

# IDE-specific files
.idea/
.vscode/

output/

frontend/dist
Loading

0 comments on commit 0dbbdf7

Please sign in to comment.