-
Notifications
You must be signed in to change notification settings - Fork 11
109 lines (109 loc) · 4.18 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
109
name: Release
on:
push:
branches-ignore:
- '*'
tags:
- '*'
jobs:
build:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with:
path: github.com/couchbase/service-broker
- name: Configure Go
uses: actions/setup-go@v2
with:
go-version: '^1.16.3'
# The release is triggered by pushing an annotated tag to the repository.
# First step is to extract the versioning information and make it available
# for other steps in the build pipeline.
- name: Constants
id: constants
run: |
VERSION=$(basename ${{ github.ref }})
APPLICATION=couchbase-service-broker
echo ::set-output name=version::${VERSION}
echo ::set-output name=archive-tgz::${APPLICATION}-${VERSION}-1.tar.gz
echo ::set-output name=archive-zip::${APPLICATION}-${VERSION}-1.zip
echo ::set-output name=archive-deb::${APPLICATION}_${VERSION}-1_amd64.deb
echo ::set-output name=archive-rpm::${APPLICATION}-${VERSION}-1.x86_64.rpm
# Make the binaries
- name: Build Binaries
run: make -e VERSION=${{ steps.constants.outputs.version }}
# Create container images
- name: Push Docker Images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: couchbase/service-broker
tag_with_ref: true
tags: latest
# Install debhelper as it's not there by default, rpm is.
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get -y install devscripts debhelper
# Build the DEB first as it will run the clean target and clear out the directory.
- name: Build Debian
run: make deb -e VERSION=${{ steps.constants.outputs.version }}
# Build the RPM.
- name: Build Red Hat
run: make rpm -e VERSION=${{ steps.constants.outputs.version }}
# Build the standard archives.
- name: Build Archive
run: make archive -e DESTDIR=/tmp/archive VERSION=${{ steps.constants.outputs.version }}
# Create a release for the version.
# TODO: we could also have pre-releases triggered by some logic.
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.constants.outputs.version }}
release_name: Version ${{ steps.constants.outputs.version }}
draft: false
prerelease: false
# Finally upload the TGZ and ZIP build artifacts to the release page for
# easy access.
- name: Upload TGZ Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.constants.outputs.archive-tgz }}
asset_name: ${{ steps.constants.outputs.archive-tgz }}
asset_content_type: application/gzip
- name: Upload ZIP Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.constants.outputs.archive-zip }}
asset_name: ${{ steps.constants.outputs.archive-zip }}
asset_content_type: application/zip
- name: Upload DEB Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.constants.outputs.archive-deb }}
asset_name: ${{ steps.constants.outputs.archive-deb }}
asset_content_type: application/vnd.debian.binary-package
- name: Upload RPM Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.constants.outputs.archive-rpm }}
asset_name: ${{ steps.constants.outputs.archive-rpm }}
asset_content_type: application/x-rpm