From 7ee86f1e9c20f3a7f555cf2bf164568f9b1d744b Mon Sep 17 00:00:00 2001 From: chevdor Date: Thu, 17 Jun 2021 20:28:39 +0200 Subject: [PATCH] ci: fix asset upload and paths --- .github/workflows/release.yml | 22 ++++++++++++++++------ Formula/tera.rb | 4 ++-- justfile | 13 +++++++++++++ templates/formula.rb | 2 +- templates/release.md | 1 - 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9eb21cc..5868876 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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"] @@ -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 @@ -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 }} @@ -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 diff --git a/Formula/tera.rb b/Formula/tera.rb index c806764..c967159 100644 --- a/Formula/tera.rb +++ b/Formula/tera.rb @@ -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 diff --git a/justfile b/justfile index af48405..1b6196d 100644 --- a/justfile +++ b/justfile @@ -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 diff --git a/templates/formula.rb b/templates/formula.rb index 827fe1b..62babf7 100644 --- a/templates/formula.rb +++ b/templates/formula.rb @@ -11,4 +11,4 @@ class {{ NAME }} < Formula def install bin.install "{{ BIN }}" end -end +end \ No newline at end of file diff --git a/templates/release.md b/templates/release.md index 4ac9b22..05601b0 100644 --- a/templates/release.md +++ b/templates/release.md @@ -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