Skip to content

Commit

Permalink
ci: fix asset upload and paths
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor committed Jun 18, 2021
1 parent 052e6ee commit 7ee86f1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get Release Version
run: |
echo GITHUB_REF=$GITHUB_REF
Expand Down Expand Up @@ -103,13 +105,12 @@ jobs:
cat $HOME/tera.rb
- name: Update Homebrew Formula
if: github.ref == 'refs/heads/master'
run: |
cp -f $HOME/tera.rb Formula/tera.rb
git config --global user.name 'TeraBot'
git config --global user.email 'chevdor@users.noreply.github.com'
git commit Formula/tera.rb -m "build: new homebrew formula for ${{ env.RELEASE_VERSION }}"
git push
git push origin HEAD:master
create_draft:
needs: ["linux", "macos"]
Expand Down Expand Up @@ -149,9 +150,8 @@ jobs:
- name: Render release notes
run: |
export DEBIAN_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/linux/tera-cli_linux_amd64.deb"
export MACOS_TGZ_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/macos/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz"
export MACOS_BIN_URL="https://github.com/chevdor/tera-cli/releases/download/${{ env.RELEASE_VERSION }}/macos/tera-macos-${{ env.RELEASE_VERSION }}"
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
Expand All @@ -178,7 +178,7 @@ jobs:
- uses: actions/download-artifact@v2

- name: Upload binaries
- name: Upload Debian package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -187,3 +187,13 @@ jobs:
asset_path: "linux/tera-cli_linux_amd64.deb"
asset_name: "tera-cli_linux_amd64.deb"
asset_content_type: application/vnd.debian.binary-package

- name: Upload MacOS archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_draft.outputs.asset_upload_url }}
asset_path: "macos/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz"
asset_name: "tera-macos-${{ env.RELEASE_VERSION }}.tar.gz"
asset_content_type: application/gzip
4 changes: 2 additions & 2 deletions Formula/tera.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class Tera < Formula
desc "A command line utility written in Rust to render templates using the tera templating engine"
homepage "https://github.com/chevdor/tera-cli"
url "https://github.com/chevdor/tera-cli/releases/download/v1.2.3/{{ name }}-mac-v1.2.3.tar.gz.tar.gz "
sha256 "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"
url "https://github.com/chevdor/tera-cli/releases/download/v1.2.3/tera-macos-v1.2.3.tar.gz"
sha256 "8839a924582932905213185610e5a3d2086e5461d98e218b58fcf973abea10ed"
version "1.2.3"

def install
Expand Down
13 changes: 13 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,16 @@ _clippy:

# Run checks such as clippy, rustfmt, etc...
check: _clippy _fmt

brew:
#!/usr/bin/env bash
RUST_LOG=info
cargo build --release
TARGET_DIR="target/release"
tar -czf $TARGET_DIR/tera-macos-$VERSION.tar.gz -C $TARGET_DIR tera
SHA256=$(shasum -a 256 $TARGET_DIR/tera-macos-$VERSION.tar.gz | awk '{ print $1}' | tee $TARGET_DIR/tera-macos-$VERSION.tar.gz.sha256)
NAME=Tera
DESCRIPTION="A command line utility written in Rust to render templates using the tera templating engine"
SITE=https://github.com
REPO=chevdor/tera-cli
tera --template templates/formula.rb --env-only > Formula/tera.rb
2 changes: 1 addition & 1 deletion templates/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class {{ NAME }} < Formula
def install
bin.install "{{ BIN }}"
end
end
end
1 change: 0 additions & 1 deletion templates/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Download the binary for your OS from below:
- [Debian package]({{ DEBIAN_URL }})
- **MacOS**
- [Archive]({{ MACOS_TGZ_URL }})
- [Binary]({{ MACOS_BIN_URL }})
# Install

## From source
Expand Down

0 comments on commit 7ee86f1

Please sign in to comment.