From bec8e6f9accd659fca5449c335a9e1a5e3619b45 Mon Sep 17 00:00:00 2001 From: cy Date: Wed, 29 Mar 2023 12:26:55 +0800 Subject: [PATCH] update release workflow --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4f7dbda --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + push: + tags: ["v[0-9]+.[0-9]+.[0-9]+*"] + +env: + CARGO_TERM_COLOR: always + +jobs: + publish: + name: Release for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + asset_name: linux-amd64 + + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --release + - name: Set the release version + run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV + - name: Create release artifacts + run: | + tar -czvf doh-cli-${{ env.RELEASE_VERSION }}-${{ matrix.asset_name }}.tar.gz \ + ./target/release/doh-cli + shasum -a 512 doh-cli-${{ env.RELEASE_VERSION }}-${{ matrix.asset_name }}.tar.gz \ + > doh-cli-${{ env.RELEASE_VERSION }}-${{ matrix.asset_name }}.tar.gz.sha512 + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: doh-cli-${{ env.RELEASE_VERSION }}-${{ matrix.asset_name }}* + file_glob: true + overwrite: true + tag: ${{ env.RELEASE_VERSION }} + release_name: "Release ${{ env.RELEASE_VERSION }}"