Skip to content

Commit 8a60c5e

Browse files
committed
feat(ci/cd): add release-please for automated release management
This commit adds release-please as a github action, replacing the develop, main and releases actions. Now, with each commit to main, a PR is either created or updated with the contents of all changes since the last release. When this PR is landed, a tag and branch are created, and the build artifacts (binaries) are uploaded as part of a regular github release. A practical result of this landing will be that all work will subsequently happen on the `main` branch (aside from backport releases) and the `develop` branch will no longer be used. When this is landed on `main`, a release will not be created as per usual. Instead, a PR will be created with the contents of the changes since the last release.
1 parent 6fb0116 commit 8a60c5e

File tree

4 files changed

+50
-85
lines changed

4 files changed

+50
-85
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,64 @@
1-
# Deploy artifacts for any pushes with a version tag (releases).
2-
name: Releases
1+
name: CI
32

43
on:
54
push:
6-
tags:
7-
- 'v*'
5+
branches:
6+
- "main"
87

98
jobs:
10-
build:
11-
name: Build and Release Artifacts
9+
build-and-publish:
1210
runs-on: ubuntu-latest
1311
steps:
12+
- uses: GoogleCloudPlatform/release-please-action@v2.1.1
13+
id: release
14+
with:
15+
token: ${{ secrets.GITHUB_TOKEN }}
16+
release-type: simple
17+
18+
# Standard build tasks
1419
- uses: actions/checkout@v2
1520
- uses: actions/setup-go@v2
1621
- name: Test
1722
run: make test
1823
- name: Build
1924
run: make cross-platform
25+
- name: Lint
26+
run: make check
27+
- name: Permissions
28+
run: chmod a+x faas_*amd*
29+
30+
# Upload all build artifacts whether it's a release or not
31+
- uses: actions/upload-artifact@v2
32+
with:
33+
name: OSX Binary
34+
path: faas_darwin_amd64
35+
- uses: actions/upload-artifact@v2
36+
with:
37+
name: Linux Binary
38+
path: faas_linux_amd64
39+
- uses: actions/upload-artifact@v2
40+
with:
41+
name: Windows Binary
42+
path: faas_windows_amd64.exe
43+
44+
# Build and push a latest image with each commit
2045
- name: Image
2146
run: make image
2247
- name: Push Image
2348
env:
2449
USER: ${{ secrets.QUAY_USER }}
2550
PASS: ${{ secrets.QUAY_TOKEN }}
2651
run: |
27-
docker login -u "$USER" -p "$PASS" quay.io
52+
docker login -u "$USER" -p "$PASS" quay.io
2853
make push && make latest
54+
55+
# The following steps are only executed if this is a release
2956
- name: Compress Binaries
57+
if: ${{ steps.release.outputs.release_created }}
3058
run: gzip faas_darwin_amd64 faas_linux_amd64 faas_windows_amd64.exe
31-
- name: Create Release
32-
id: create_release
33-
uses: actions/create-release@v1
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
with:
37-
tag_name: ${{ github.ref }}
38-
release_name: Release ${{ github.ref }}
39-
draft: false
40-
prerelease: false
4159
- name: Upload Darwin Binary
4260
uses: actions/upload-release-asset@v1
61+
if: ${{ steps.release.outputs.release_created }}
4362
env:
4463
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4564
with:
@@ -49,6 +68,7 @@ jobs:
4968
asset_content_type: application/x-gzip
5069
- name: Upload Linux Binary
5170
uses: actions/upload-release-asset@v1
71+
if: ${{ steps.release.outputs.release_created }}
5272
env:
5373
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5474
with:
@@ -58,10 +78,22 @@ jobs:
5878
asset_content_type: application/x-gzip
5979
- name: Upload Windows Binary
6080
uses: actions/upload-release-asset@v1
81+
if: ${{ steps.release.outputs.release_created }}
6182
env:
6283
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6384
with:
6485
upload_url: ${{ steps.create_release.outputs.upload_url }}
6586
asset_path: ./faas_windows_amd64.exe.gz
6687
asset_name: faas_windows_amd64.exe.gz
6788
asset_content_type: application/x-gzip
89+
- name: Create Release
90+
id: create_release
91+
if: ${{ steps.release.outputs.release_created }}
92+
uses: actions/create-release@v1
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
with:
96+
tag_name: ${{ github.ref }}
97+
release_name: Release ${{ github.ref }}
98+
draft: false
99+
prerelease: false

.github/workflows/develop.yaml

-41
This file was deleted.

.github/workflows/main.yaml

-27
This file was deleted.

version.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.6.2

0 commit comments

Comments
 (0)