-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (63 loc) · 2.3 KB
/
release.yaml
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
name: Release
# This workflow is triggered manually
on:
workflow_dispatch:
inputs:
version_bump_type:
description: 'Version Bump Type (major, minor, patch)'
required: true
default: 'patch'
jobs:
build:
name: Build
runs-on: ubuntu-latest
container: golang:1.18
env:
PROJECT_PATH: /go/src/github.com/packagrio/bumpr
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Bump version
id: bump_version
uses: packagrio/action-bumpr-go@dogfood
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version_bump_type: ${{ github.event.inputs.version_bump_type }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
env:
GOOS: linux
GOARCH: amd64
run: |
mkdir -p $PROJECT_PATH
cp -a $GITHUB_WORKSPACE/. $PROJECT_PATH/
cd $PROJECT_PATH
go mod vendor
go test -mod vendor -v -tags "static" ./...
# build linux binary
go build -mod vendor -ldflags "-X main.goos=linux -X main.goarch=amd64" -o packagr-bumpr-linux-amd64 -tags "static" cmd/bumpr/bumpr.go
# build mac binary
go build -mod vendor -ldflags "-X main.goos=darwin -X main.goarch=amd64" -o packagr-bumpr-darwin-amd64 -tags "static" cmd/bumpr/bumpr.go
chmod +x packagr-bumpr-linux-amd64
chmod +x packagr-bumpr-darwin-amd64
./packagr-bumpr-linux-amd64 --help
echo "listing linked libraries" && ldd packagr-bumpr-linux-amd64
# restore modified dir to GH workspace.
cp -arf $PROJECT_PATH/. $GITHUB_WORKSPACE/
- name: Commit Changes
id: commit
uses: packagrio/action-releasr-go@dogfood
env:
# This is necessary in order to push a commit to the repo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
- name: Publish Release
id: publish
uses: packagrio/action-publishr-go@dogfood
env:
# This is necessary in order to push a commit to the repo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
with:
upload_assets: 'packagr-bumpr-linux-amd64 packagr-bumpr-darwin-amd64'