From c58b1b3be0a7ff4f5b8c909666865f8c8d6d59ad Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 2 Nov 2020 00:03:14 +0100 Subject: [PATCH] Try to automate the publication of releases --- .github/workflows/release.yml | 75 +++++++++++++++++++++++++++++++++++ .github/workflows/rust.yml | 37 ----------------- .github/workflows/test.yml | 20 ++++++++++ Cargo.toml | 2 +- 4 files changed, 96 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/rust.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..96a41e4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,75 @@ +name: Release + +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} + + - uses: actions/checkout@master + + - uses: hecrj/setup-rust-action@master + with: + rust-version: stable + + - name: Check Cargo availability + run: cargo --version + + - name: Check Rustup default toolchain + run: rustup default | grep stable + + - name: Install cargo-deb + run: cargo install --debug cargo-deb + + - name: Build + run: | + echo 'lto = "fat"' >> Cargo.toml + env RUSTFLAGS="-C link-arg=-s" cargo build --release + mkdir encrypted-dns + mv target/release/encrypted-dns encrypted-dns/ + cp README.md example-encrypted-dns.toml encrypted-dns/ + tar cJpf encrypted-dns_${{ steps.get_version.outputs.VERSION }}_linux-x86_64.tar.bz2 encrypted-dns + - name: Debian package + run: | + cargo deb + + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true + prerelease: false + + - name: Upload Debian package + id: upload-release-asset-debian + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: "encrypted-dns_${{ steps.get_version.outputs.VERSION }}_amd64.deb" + asset_path: "target/debian/encrypted-dns_${{ steps.get_version.outputs.VERSION }}_amd64.deb" + asset_content_type: application/x-debian-package + + - name: Upload tarball + id: upload-release-asset-tarball + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: "encrypted-dns_${{ steps.get_version.outputs.VERSION }}_linux-x86_64.tar.bz2" + asset_path: "encrypted-dns_${{ steps.get_version.outputs.VERSION }}_linux-x86_64.tar.bz2" + asset_content_type: application/x-tar diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index a3e498b..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Rust - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@master - - uses: hecrj/setup-rust-action@master - with: - rust-version: nightly - - name: Check Cargo availability - run: cargo --version - - name: Check Rustup default toolchain - run: rustup default | grep nightly - - name: Install cargo-deb - run: cargo install --debug cargo-deb - - name: Build - run: | - echo 'lto = "fat"' >> Cargo.toml - env RUSTFLAGS="-C link-arg=-s" cargo build --release - mkdir encrypted-dns - mv target/release/encrypted-dns encrypted-dns/ - cp README.md example-encrypted-dns.toml encrypted-dns/ - - name: Debian package - run: | - cargo deb - - uses: actions/upload-artifact@master - with: - name: encrypted-dns-linux-x86_64 - path: encrypted-dns - - uses: actions/upload-artifact@master - with: - name: debian - path: target/debian diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e024fbb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Test + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - uses: hecrj/setup-rust-action@master + with: + rust-version: nightly + - name: Check Cargo availability + run: cargo --version + - name: Check Rustup default toolchain + run: rustup default | grep nightly + - name: Test + run: | + cargo test diff --git a/Cargo.toml b/Cargo.toml index eea018d..c60c03e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "encrypted-dns" -version = "0.3.19" +version = "0.3.20" authors = ["Frank Denis "] edition = "2018" description = "A modern encrypted DNS server (DNSCrypt v2, Anonymized DNSCrypt, DoH)"