Skip to content

Commit

Permalink
ci(github-actions): add a GitHub Action to add linux and windowns bin…
Browse files Browse the repository at this point in the history
…aries to GitHub Release
  • Loading branch information
hituzi-no-sippo committed Sep 24, 2024
1 parent 9bc1ce5 commit 0861d24
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,22 @@ jobs:
- name: Render release notes
run: |
x86_64_prefix='tera-cli-x86_64-'
export X86_64_GNU_TGZ="${x86_64_prefix}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 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
Expand Down Expand Up @@ -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 }}
18 changes: 18 additions & 0 deletions templates/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0861d24

Please sign in to comment.