Skip to content

Commit

Permalink
release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Apr 27, 2024
1 parent c13acd2 commit b041eef
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/workflows/install-cross.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

curl -s https://api.github.com/repos/cross-rs/cross/releases/latest \
| grep cross-x86_64-unknown-linux-gnu.tar.gz \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -

tar -zxvf cross-x86_64-unknown-linux-gnu.tar.gz -C /usr/bin
rm -f cross-x86_64-unknown-linux-gnu.tar.gz

83 changes: 83 additions & 0 deletions .github/workflows/publish-exe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
on:
push:
tags:
- "v*.*.*"

name: Publish Releases

jobs:
build_publish:
name: Publishing Tasks
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- i686-unknown-linux-musl
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- arm-unknown-linux-gnueabihf
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc

include:
- target: x86_64-unknown-linux-gnu
host_os: ubuntu-latest
- target: x86_64-unknown-linux-musl
host_os: ubuntu-latest
- target: i686-unknown-linux-musl
host_os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
host_os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
host_os: ubuntu-latest
- target: arm-unknown-linux-gnueabihf
host_os: ubuntu-latest
- target: x86_64-apple-darwin
host_os: macos-latest
- target: aarch64-apple-darwin
host_os: macos-latest
- target: x86_64-pc-windows-msvc
host_os: windows-latest
- target: i686-pc-windows-msvc
host_os: windows-latest

runs-on: ${{ matrix.host_os }}
steps:
- uses: actions/checkout@v3

- name: Prepare
shell: bash
run: |
mkdir mypubdir4
rustup target add ${{ matrix.target }}
if [[ "${{ matrix.host_os }}" == "ubuntu-latest" ]]; then
sudo .github/workflows/install-cross.sh
fi
- name: Build
shell: bash
run: |
if [[ "${{ matrix.host_os }}" == "ubuntu-latest" ]]; then
cross build --release --target ${{ matrix.target }}
else
cargo build --release --target ${{ matrix.target }}
fi
if [[ "${{ matrix.host_os }}" == "windows-latest" ]]; then
powershell -Command "(Get-Item README.md).LastWriteTime = Get-Date"
powershell Compress-Archive -Path target/${{ matrix.target }}/release/dns-over-https.exe, README.md -DestinationPath mypubdir4/dns-over-https-${{ matrix.target }}.zip
elif [[ "${{ matrix.host_os }}" == "macos-latest" ]]; then
zip -j mypubdir4/dns-over-https-${{ matrix.target }}.zip target/${{ matrix.target }}/release/dns-over-https README.md
elif [[ "${{ matrix.host_os }}" == "ubuntu-latest" ]]; then
zip -j mypubdir4/dns-over-https-${{ matrix.target }}.zip target/${{ matrix.target }}/release/dns-over-https README.md
fi
- name: Publish
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: mypubdir4/*

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ dotenvy = "0.15"
env_logger = "0.11"
futures = "0.3"
log = { version = "0.4", features = ["std"] }
reqwest = { version = "0.12", features = [] }
reqwest = { version = "0.12", default-features = false, features = [
"rustls-tls",
] }
thiserror = "1"
tokio = { version = "1", features = ["full"] }
tokio-util = "0.7"
Expand Down

0 comments on commit b041eef

Please sign in to comment.