Skip to content

Commit 7ee86f1

Browse files
committed
ci: fix asset upload and paths
1 parent 052e6ee commit 7ee86f1

5 files changed

Lines changed: 32 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
runs-on: macos-latest
4444
steps:
4545
- uses: actions/checkout@v2
46+
with:
47+
fetch-depth: 0
4648
- name: Get Release Version
4749
run: |
4850
echo GITHUB_REF=$GITHUB_REF
@@ -103,13 +105,12 @@ jobs:
103105
cat $HOME/tera.rb
104106
105107
- name: Update Homebrew Formula
106-
if: github.ref == 'refs/heads/master'
107108
run: |
108109
cp -f $HOME/tera.rb Formula/tera.rb
109110
git config --global user.name 'TeraBot'
110111
git config --global user.email 'chevdor@users.noreply.github.com'
111112
git commit Formula/tera.rb -m "build: new homebrew formula for ${{ env.RELEASE_VERSION }}"
112-
git push
113+
git push origin HEAD:master
113114
114115
create_draft:
115116
needs: ["linux", "macos"]
@@ -149,9 +150,8 @@ jobs:
149150
150151
- name: Render release notes
151152
run: |
152-
export DEBIAN_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/linux/tera-cli_linux_amd64.deb"
153-
export MACOS_TGZ_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/macos/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz"
154-
export MACOS_BIN_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/macos/tera-macos-${{ env.RELEASE_VERSION }}"
153+
export DEBIAN_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/tera-cli_linux_amd64.deb"
154+
export MACOS_TGZ_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz"
155155
export CHANGELOG=$(cat changelog.md)
156156
tera --env --env-only --template templates/release.md > RELEASE_NOTES.md
157157
@@ -178,7 +178,7 @@ jobs:
178178
179179
- uses: actions/download-artifact@v2
180180

181-
- name: Upload binaries
181+
- name: Upload Debian package
182182
uses: actions/upload-release-asset@v1
183183
env:
184184
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -187,3 +187,13 @@ jobs:
187187
asset_path: "linux/tera-cli_linux_amd64.deb"
188188
asset_name: "tera-cli_linux_amd64.deb"
189189
asset_content_type: application/vnd.debian.binary-package
190+
191+
- name: Upload MacOS archive
192+
uses: actions/upload-release-asset@v1
193+
env:
194+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195+
with:
196+
upload_url: ${{ needs.create_draft.outputs.asset_upload_url }}
197+
asset_path: "macos/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz"
198+
asset_name: "tera-macos-${{ env.RELEASE_VERSION }}.tar.gz"
199+
asset_content_type: application/gzip

Formula/tera.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class Tera < Formula
22
desc "A command line utility written in Rust to render templates using the tera templating engine"
33
homepage "https://github.com/chevdor/tera-cli"
4-
url "https://github.com/chevdor/tera-cli/releases/download/v1.2.3/{{ name }}-mac-v1.2.3.tar.gz.tar.gz "
5-
sha256 "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"
4+
url "https://github.com/chevdor/tera-cli/releases/download/v1.2.3/tera-macos-v1.2.3.tar.gz"
5+
sha256 "8839a924582932905213185610e5a3d2086e5461d98e218b58fcf973abea10ed"
66
version "1.2.3"
77

88
def install

justfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,16 @@ _clippy:
2929

3030
# Run checks such as clippy, rustfmt, etc...
3131
check: _clippy _fmt
32+
33+
brew:
34+
#!/usr/bin/env bash
35+
RUST_LOG=info
36+
cargo build --release
37+
TARGET_DIR="target/release"
38+
tar -czf $TARGET_DIR/tera-macos-$VERSION.tar.gz -C $TARGET_DIR tera
39+
SHA256=$(shasum -a 256 $TARGET_DIR/tera-macos-$VERSION.tar.gz | awk '{ print $1}' | tee $TARGET_DIR/tera-macos-$VERSION.tar.gz.sha256)
40+
NAME=Tera
41+
DESCRIPTION="A command line utility written in Rust to render templates using the tera templating engine"
42+
SITE=https://github.com
43+
REPO=chevdor/tera-cli
44+
tera --template templates/formula.rb --env-only > Formula/tera.rb

templates/formula.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class {{ NAME }} < Formula
1111
def install
1212
bin.install "{{ BIN }}"
1313
end
14-
end
14+
end

templates/release.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Download the binary for your OS from below:
99
- [Debian package]({{ DEBIAN_URL }})
1010
- **MacOS**
1111
- [Archive]({{ MACOS_TGZ_URL }})
12-
- [Binary]({{ MACOS_BIN_URL }})
1312
# Install
1413

1514
## From source

0 commit comments

Comments
 (0)