forked from chevdor/tera-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (88 loc) · 3.11 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Release
on:
push:
tags:
- "v*"
jobs:
update-homebrew:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build MacOS binary
id: build-macos-binary
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: tera
target: x86_64-apple-darwin
archive: tera-cli-$target
checksum: sha256
dry-run: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Add tera to PATH
run: |
mv "target/x86_64-apple-darwin/release/tera" /usr/local/bin
- name: Output values for templates
id: output-values-for-templates
run: |
echo GITHUB_REF=$GITHUB_REF
RELEASE_VERSION=${GITHUB_REF#refs/*/}
RAW_VERSION=${RELEASE_VERSION:1}
echo "RAW_VERSION=$RAW_VERSION" >> $GITHUB_OUTPUT
SHA256="$(cut -d' ' -f1 ${{ steps.build-macos-binary.outputs.sha256 }})"
echo "SHA256=$SHA256" >> $GITHUB_OUTPUT
# We do that before hecking out master (in case we were not in master already)
- name: Prepare new Formula
env:
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
ARCHIVE: ${{ steps.build-macos-binary.outputs.archive }}
SHA256: ${{ steps.output-values-for-templates.outputs.SHA256 }}
VERSION: ${{ steps.output-values-for-templates.outputs.RAW_VERSION }}
run: |
tera --version
tera --template templates/formula.rb --env-only > $HOME/tera.rb
cat $HOME/tera.rb
- name: Update Homebrew Formula
run: |
cp -f $HOME/tera.rb Formula/tera.rb
git config --global user.name 'TeraBot'
git config --global user.email '[email protected]'
git commit Formula/tera.rb -m "build: new homebrew formula for ${{ env.RELEASE_VERSION }}"
test:
needs: ["update-homebrew"]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: sha256
id: sha256
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: tera
target: x86_64-apple-darwin
archive: tera-cli-$target
checksum: sha256,sha512
dry-run: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: cat sha256
run: |
cat ${{ steps.sha256.outputs.sha256 }}
cat ${{ steps.sha256.outputs.sha512 }}
rm ${{ steps.sha256.outputs.sha256 }}
rm ${{ steps.sha256.outputs.sha512 }}
rm ${{ steps.sha256.outputs.archive }}.tar.gz
- name: sha512
id: sha512
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: tera
target: x86_64-apple-darwin
archive: tera-cli-$target
checksum: sha256,sha512
dry-run: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: cat sha512
run: |
cat ${{ steps.sha512.outputs.sha256 }}
cat ${{ steps.sha512.outputs.sha512 }}