This repository has been archived by the owner on Jun 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
65 lines (60 loc) · 2.39 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
name: Release Wash
on:
release:
types: [published]
jobs:
build-deploy:
name: Build and upload release assets
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Get dependencies
run: go get -v -t -d ./...
- name: Build Wash
run: |
tag=${GITHUB_REF#refs/tags/}
LINKFLAGS="-w -s -X github.com/puppetlabs/wash/cmd/version.BuildVersion=${tag}"
CGO_ENABLED= GOOS=darwin GOARCH=amd64 go build -ldflags="$LINKFLAGS"
tar czf wash-${tag}-x86_64-apple-darwin.tgz wash
cp wash-${tag}-x86_64-apple-darwin.tgz wash-x86_64-apple-darwin.tgz
CGO_ENABLED= GOOS=linux GOARCH=amd64 go build -ldflags="$LINKFLAGS"
tar czf wash-${tag}-x86_64-unknown-linux.tgz wash
cp wash-${tag}-x86_64-unknown-linux.tgz wash-x86_64-unknown-linux.tgz
- name: Upload release assets
uses: skx/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'wash-*.tgz'
update-tap:
name: Update Homebrew tap
runs-on: ubuntu-latest
steps:
- name: Update
run: |
git clone https://${GITHUB_TOKEN}@github.com/puppetlabs/homebrew-puppet
tag=${GITHUB_REF#refs/tags/}
curl -OL https://github.com/puppetlabs/wash/archive/${tag}.tar.gz
sha=$(sha256sum ${tag}.tar.gz | cut -f1 -d' ')
cd homebrew-puppet
sed -e "s/version = \".*\"/version = \"${tag}\"/g" -i ./Formula/wash.rb
sed -e "s/sha256 \".*\"/sha256 \"${sha}\"/g" -i ./Formula/wash.rb
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
publish_branch="wash-${tag}"
git checkout -b ${publish_branch}
commit_message="Update Wash to ${tag}"
git commit -am "${commit_message}"
git push origin ${publish_branch}
PULLS_URI="https://api.github.com/repos/puppetlabs/homebrew-puppet/pulls"
AUTH_HEADER="Authorization: token $GITHUB_TOKEN"
new_pr_resp=$(curl --data "{\"title\": \"${commit_message}\", \"head\": \"${publish_branch}\", \"base\": \"master\"}" -X POST -s -H "${AUTH_HEADER}" ${PULLS_URI})
echo "$new_pr_resp"
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_DEPLOY_TOKEN }}