|
36 | 36 | name: linux |
37 | 37 | path: "tera-cli_linux_amd64.deb" |
38 | 38 |
|
| 39 | + macos: |
| 40 | + env: |
| 41 | + TARGET_DIR: target/release |
| 42 | + |
| 43 | + runs-on: macos-latest |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v2 |
| 46 | + - name: Get Release Version |
| 47 | + run: | |
| 48 | + echo GITHUB_REF=$GITHUB_REF |
| 49 | + RELEASE_VERSION=${GITHUB_REF#refs/*/} |
| 50 | + RAW_VERSION=${RELEASE_VERSION:1} |
| 51 | + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV |
| 52 | + echo "RAW_VERSION=$RAW_VERSION" >> $GITHUB_ENV |
| 53 | + echo "SHORT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV |
| 54 | +
|
| 55 | + - name: Install latest nightly |
| 56 | + uses: actions-rs/toolchain@v1 |
| 57 | + with: |
| 58 | + toolchain: nightly |
| 59 | + override: true |
| 60 | + components: rustfmt, clippy |
| 61 | + |
| 62 | + - name: Check tooling |
| 63 | + shell: bash |
| 64 | + run: | |
| 65 | + tar --version |
| 66 | + shasum --version |
| 67 | +
|
| 68 | + - name: Build MacOS binary |
| 69 | + shell: bash |
| 70 | + run: | |
| 71 | + cargo build --release |
| 72 | + # echo "${{ github.workspace }}/${{ env.TARGET_DIR }}" >> $GITHUB_PATH |
| 73 | + cp "${{ env.TARGET_DIR }}/tera" /usr/local/bin |
| 74 | +
|
| 75 | + - name: Compress & sha256 |
| 76 | + run: | |
| 77 | + tar -czf ${{ env.TARGET_DIR }}/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz -C ${{ env.TARGET_DIR }} tera |
| 78 | + SHA256=$(shasum -a 256 ${{ env.TARGET_DIR }}/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz | awk '{ print $1}' | tee ${{ env.TARGET_DIR }}/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz.sha256) |
| 79 | + echo SHA256: $SHA256 |
| 80 | + echo "SHA256=$SHA256" >> $GITHUB_ENV |
| 81 | +
|
| 82 | + - name: Upload artifacts |
| 83 | + uses: actions/upload-artifact@v2 |
| 84 | + with: |
| 85 | + name: macos |
| 86 | + path: | |
| 87 | + ${{ env.TARGET_DIR }}/tera |
| 88 | + ${{ env.TARGET_DIR }}/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz |
| 89 | + ${{ env.TARGET_DIR }}/tera-macos-${{ env.RELEASE_VERSION }}.tar.gz.sha256 |
| 90 | +
|
| 91 | + # We do that before checking out master (in case we were not in master already) |
| 92 | + - name: Prepare new Formula |
| 93 | + env: |
| 94 | + NAME: Tera |
| 95 | + DESCRIPTION: "A command line utility written in Rust to render templates using the tera templating engine" |
| 96 | + SITE: https://github.com |
| 97 | + REPO: chevdor/tera-cli |
| 98 | + SHA256: ${{env.SHA256}} |
| 99 | + VERSION: ${{env.RAW_VERSION}} |
| 100 | + run: | |
| 101 | + tera --version |
| 102 | + tera --template templates/formula.rb --env-only > $HOME/tera.rb |
| 103 | + cat $HOME/tera.rb |
| 104 | +
|
| 105 | + - name: Update Homebrew Formula |
| 106 | + if: github.ref == 'refs/heads/master' |
| 107 | + run: | |
| 108 | + cp -f $HOME/tera.rb Formula/tera.rb |
| 109 | + git config --global user.name 'TeraBot' |
| 110 | + git config --global user.email 'chevdor@users.noreply.github.com' |
| 111 | + git commit Formula/tera.rb -m "build: new homebrew formula for ${{ env.RELEASE_VERSION }}" |
| 112 | + git push |
| 113 | +
|
39 | 114 | create_draft: |
40 | | - needs: ["linux"] |
| 115 | + needs: ["linux", "macos"] |
41 | 116 | name: Create Draft |
42 | 117 | runs-on: ubuntu-latest |
43 | 118 | outputs: |
|
75 | 150 | - name: Render release notes |
76 | 151 | run: | |
77 | 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 }}" |
78 | 155 | export CHANGELOG=$(cat changelog.md) |
79 | 156 | tera --env --env-only --template templates/release.md > RELEASE_NOTES.md |
80 | 157 |
|
|
87 | 164 | tag_name: ${{ env.RELEASE_VERSION }} |
88 | 165 | release_name: Tera ${{ env.RELEASE_VERSION }} (${{ env.SHORT_SHA }}) |
89 | 166 | body_path: ./RELEASE_NOTES.md |
90 | | - draft: false |
| 167 | + draft: true |
91 | 168 |
|
92 | 169 | publish-binaries: |
93 | 170 | runs-on: ubuntu-latest |
|
0 commit comments