From 92b5d0fab13dd7d2198f59e222dbe095bab893dd Mon Sep 17 00:00:00 2001 From: hituzi no sippo Date: Mon, 23 Sep 2024 14:42:11 +0900 Subject: [PATCH] ci(github-actions): add a GitHub Action to add linux and windowns binaries to GitHub Release --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ templates/release.md | 18 +++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5bab13..81147c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -150,10 +150,22 @@ jobs: - name: Render release notes run: | + export X86_64_GNU_TGZ='tera-cli-x86_64-unknown-linux-gnu.tar.gz' + export X86_64_MUSL_TGZ="${X86_64_GNU_TGZ//gnu/musl}" + + export AARCH64_GNU_TGZ="${X86_64_GNU_TGZ//x86_64/aarch64}" + export AARCH64_MUSL_TGZ="${X86_64_MUSL_TGZ//x86_64/aarch64}" + export DEBIAN_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/tera-cli_linux_amd64.deb" export MACOS_TGZ_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz" + + export WINDOWS_ZIP='tera-cli-x86_64-pc-windows-msvc.zip' + export CHANGELOG=$(cat changelog.md) tera --env --env-only --template templates/release.md > RELEASE_NOTES.md + env: + ARCHIVE_URL_PREFIX: ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ env.RELEASE_VERSION }}/ + WINDOWS_ZIP: tera-cli-x86_64-pc-windows-msvc.zip - name: Create Release id: create-release @@ -197,3 +209,32 @@ jobs: asset_path: "macos/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz" asset_name: "tera-macos-${{ env.RELEASE_VERSION }}.tar.gz" asset_content_type: application/gzip + + publish-linux-and-windowns-binaries: + needs: ["create_draft"] + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + - os: ubuntu-latest + target: aarch64-unknown-linux-musl + - os: windows-latest + target: x86_64-pc-windows-msvc + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - name: Upload Binarise + uses: taiki-e/upload-rust-binary-action@v1 + with: + bin: tera + target: ${{ matrix.target }} + archive: tera-cli-$target + checksum: sha512 + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/templates/release.md b/templates/release.md index 5332e10..6293bed 100644 --- a/templates/release.md +++ b/templates/release.md @@ -6,9 +6,16 @@ You can find the changelogs below. Download the binary for your OS from below: - **Linux** + - [x86_64 gnu]({{ ARCHIVE_URL_PREFIX ~ X86_64_GNU_TGZ }}) + - [x86_64 musl]({{ ARCHIVE_URL_PREFIX ~ X86_64_MUSL_TGZ }}) + - [aarch64 gnu]({{ ARCHIVE_URL_PREFIX ~ AARCH64_GNU_TGZ }}) + - [aarch64 musl]({{ ARCHIVE_URL_PREFIX ~ AARCH64_MUSL_TGZ }}) - [Debian package]({{ DEBIAN_URL }}) - **MacOS** - [Archive]({{ MACOS_TGZ_URL }}) +- **Windows** + - [Archive]({{ ARCHIVE_URL_PREFIX ~ WINDOWS_ZIP }}) + # Install ## From source @@ -18,6 +25,17 @@ cargo install --git https://github.com/chevdor/tera-cli ``` ## Linux + +### Binaries + +``` +wget {{ ARCHIVE_URL_PREFIX ~ X86_64_GNU_TGZ }} +tar xf {[ X86_64_GNU_TGZ }} +./tera --help +``` + +### Debian + ``` wget {{ DEBIAN_URL }} dpkg -i tera-cli_linux_amd64.deb