-
Notifications
You must be signed in to change notification settings - Fork 4
108 lines (96 loc) · 4.78 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
102
103
104
105
106
107
108
name: CF-Puppeteer Release
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: Prepare, Build, Release, Publish
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Checkout code
uses: actions/checkout@v2
id: checkout
- name: Create artifacts dirs
run: |
mkdir -p ./artifacts
- name: Create linux binary
id: create_linux_binary
run: |
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o ./artifacts/cf-puppeteer-linux github.com/happytobi/cf-puppeteer
LIN_HASH=$(shasum ./artifacts/cf-puppeteer-linux)
echo "::set-env name=LIN_HASH::$LIN_HASH"
echo "::set-output name=dir::$(echo "./artifacts/cf-puppeteer-linux")"
echo "::set-output name=file::$(echo "cf-puppeteer-linux")"
- name: Create mac binary
id: create_mac_binary
run: |
CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -o ./artifacts/cf-puppeteer-darwin github.com/happytobi/cf-puppeteer
OSX_HASH=$(shasum ./artifacts/cf-puppeteer-darwin)
echo "::set-env name=OSX_HASH::$OSX_HASH"
echo "::set-output name=dir::$(echo "./artifacts/cf-puppeteer-darwin")"
echo "::set-output name=file::$(echo "cf-puppeteer-darwin")"
- name: Create win binary
id: create_win_binary
run: |
CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -o ./artifacts/cf-puppeteer.exe github.com/happytobi/cf-puppeteer
WIN_HASH=$(shasum ./artifacts/cf-puppeteer.exe)
echo "::set-env name=WIN_HASH::$WIN_HASH"
echo "::set-output name=dir::$(echo "./artifacts/cf-puppeteer.exe")"
echo "::set-output name=file::$(echo "cf-puppeteer.exe")"
- name: Get Version
run: |
version=$(echo "${GITHUB_REF}" |sed 's#refs/tags/v##g' )
echo "::set-env name=VERSION::$version"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: New Release version ${{ env.VERSION }}
draft: false
prerelease: false
body: |
The new release Version ${{ env.VERSION }} is here
to see all changes read the Blog [post](https://cf-puppeteer.happytobi.com/posts/release_${{ env.VERSION }}/)
SHA1 Hashes for files
OSX: ${{ env.OSX_HASH }}
WIN: ${{ env.WIN_HASH }}
LIN: ${{ env.LIN_HASH }}
- name: Upload Release Asset Linux
id: upload-release-asset_linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ steps.create_linux_binary.outputs.dir }}
asset_name: ${{ steps.create_linux_binary.outputs.file }}
asset_content_type: application/octet-stream
- name: Upload Release Asset Mac
id: upload-release-asset_mac
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ steps.create_mac_binary.outputs.dir }}
asset_name: ${{ steps.create_mac_binary.outputs.file }}
asset_content_type: application/octet-stream
- name: Upload Release Asset Windows
id: upload-release-asset_win
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ steps.create_win_binary.outputs.dir }}
asset_name: ${{ steps.create_win_binary.outputs.file }}
asset_content_type: application/octet-stream