-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (83 loc) · 2.91 KB
/
release.yml
File metadata and controls
86 lines (83 loc) · 2.91 KB
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
name: Upload Release Asset
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create-release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
# Any variables can not be shared between jobs, thus copy the URL
# of the created Github release into a file as an artifact
- name: Create release URL file
env:
RELEASE_URL: ${{ steps.create-release.outputs.upload_url }}
run: |
echo "${RELEASE_URL}" > release-url.txt
- name: Upload Release URL file
uses: actions/upload-artifact@v1
with:
name: release-url
path: release-url.txt
release-assets:
name: Release assets
runs-on: ubuntu-latest
needs: create-release # release must be created before this job can start
strategy:
matrix:
version: ['linux-amd64', 'windows-amd64', 'darwin-amd64']
include:
- version: linux-amd64
OS: linux
ARCH: amd64
- version: windows-amd64
OS: windows
ARCH: amd64
- version: darwin-amd64
OS: darwin
ARCH: amd64
steps:
- name: Checkout Project
uses: actions/checkout@master
# Build Code for Specific OS and Architecture in the Project
- name: Build Project
env:
GOOS: ${{ matrix.OS }}
GOARCH: ${{ matrix.ARCH }}
run: |
GOOS=${GOOS} GOARCH=${GOARCH} \
go build -o bin/awsping_${GOOS}_${GOARCH} .
zip --junk-paths -r awsping bin
- name: Download Release URL file
uses: actions/download-artifact@v1
with:
name: release-url
# Write content of downloaded file into a step.outputs variable
- name: Read Release URL
id: get-release-url
run: echo ::set-output name=upload_url::$(cat release-url/release-url.txt)
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get-release-url.outputs.upload_url }}
# `upload_url` pulls original from the CREATE RELEASE step and
# uploaded it as artifact above, ee this blog post for more info:
# https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: awsping.zip
asset_name: awsping-${{ matrix.OS}}-${{matrix.ARCH}}.zip
asset_content_type: application/zip