Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lxl66566 committed Sep 22, 2024
1 parent a9cb896 commit 2a151a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 87 deletions.
93 changes: 6 additions & 87 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,18 @@
name: Build/publish release

name: rust release action
on:
push:
tags:
- "v*"
workflow_dispatch:

jobs:
create-release:
if: (startsWith(github.ref_name, 'v') && github.ref_type == 'tag')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
with:
title: $version
token: ${{ secrets.GH_TOKEN }}

release:
name: Binary ${{ matrix.target }} (on ${{ matrix.os }})
continue-on-error: false
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
compress: true
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
compress: true
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
compress: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
compress: true
- os: windows-latest
compress: true
- os: macos-latest
target: x86_64-apple-darwin
compress: true
- os: macos-latest
target: aarch64-apple-darwin
compress: true
- os: ubuntu-latest
target: x86_64-unknown-freebsd
compress: true

# The type of runner that the job will run on
# Runs on Ubuntu if other os is not specified above
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
timeout-minutes: 90
permissions:
contents: write
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4

- name: create version file
if: (startsWith(github.ref_name, 'v') && github.ref_type == 'tag')
run: echo "${{github.ref_name}}" | tail -c+2 >> .build_version

- name: Get version from tag
id: extract_version
run: |
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
shell: bash

- name: Setup Rust toolchain
# uses: dtolnay/rust-toolchain@nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- run: sudo apt install musl-tools
if: startsWith(matrix.os, 'ubuntu')

- name: Install openssl on ubuntu if needed
if: startsWith(matrix.os, 'ubuntu')
run: grep -q 'openssl' 'Cargo.lock' && sudo apt install pkg-config libssl-dev || true
- name: Install openssl on macos if needed
if: startsWith(matrix.os, 'macos')
run: grep -q 'openssl' 'Cargo.lock' && brew install openssl || true
# - name: Set Perl environment variables
# if: runner.os == 'Windows'
# run: |
# # choco install openssl strawberryperl
# echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
# echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

- name: Build and Upload
uses: taiki-e/upload-rust-binary-action@v1
- name: test build rust project
uses: lxl66566/rust-simple-release@main
with:
bin: git-se
target: ${{ matrix.target }}
tar: unix
zip: windows
targets: aarch64-unknown-linux-gnu, aarch64-unknown-linux-musl, x86_64-pc-windows-msvc, x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu, aarch64-apple-darwin, x86_64-apple-darwin
token: ${{ secrets.GH_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Type `git-se -h` and `git-se [subcommand] -h` to get more information.
- `git add -A` is automatically executed when encrypting, so make sure that `.gitignore` is handled properly.
- Do not add files with `.zst`, `.enc` suffixes and folders containing them to the encrypted list.
- To delete file/dir from encrypt list, edit `git_simple_encrypt.toml`.
- encrypt/decrypt will keep the file metadata unchanged (unix permission and timestamp).

## Algorithm

Expand Down
1 change: 1 addition & 0 deletions docs/README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ git-se d 'src/*' # 部分解密
- 加密时会自动执行 `git add -A`,请确保已妥善处理 `.gitignore`
- 请不要将 `.zst`, `.enc` 后缀的文件以及包含它们的文件夹添加到加密列表中。
- 如果您需要从加密列表中删除文件(夹),请手动编辑 `git_simple_encrypt.toml`
- 加密解密会保持文件元数据,例如权限和时间戳。

## 原理

Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "nightly"
components = ["rustfmt", "clippy", "rust-src"]

0 comments on commit 2a151a7

Please sign in to comment.