Skip to content

Commit

Permalink
feat(ci/cd): add release-please for automated release management
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lance committed Sep 10, 2020
1 parent 6fb0116 commit 8a60c5e
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 85 deletions.
66 changes: 49 additions & 17 deletions .github/workflows/releases.yaml → .github/workflows/ci.yaml
@@ -1,45 +1,64 @@
# Deploy artifacts for any pushes with a version tag (releases).
name: Releases
name: CI

on:
push:
tags:
- 'v*'
branches:
- "main"

jobs:
build:
name: Build and Release Artifacts
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2.1.1
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple

# Standard build tasks
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- name: Test
run: make test
- name: Build
run: make cross-platform
- name: Lint
run: make check
- name: Permissions
run: chmod a+x faas_*amd*

# Upload all build artifacts whether it's a release or not
- uses: actions/upload-artifact@v2
with:
name: OSX Binary
path: faas_darwin_amd64
- uses: actions/upload-artifact@v2
with:
name: Linux Binary
path: faas_linux_amd64
- uses: actions/upload-artifact@v2
with:
name: Windows Binary
path: faas_windows_amd64.exe

# Build and push a latest image with each commit
- name: Image
run: make image
- name: Push Image
env:
USER: ${{ secrets.QUAY_USER }}
PASS: ${{ secrets.QUAY_TOKEN }}
run: |
docker login -u "$USER" -p "$PASS" quay.io
docker login -u "$USER" -p "$PASS" quay.io
make push && make latest
# The following steps are only executed if this is a release
- name: Compress Binaries
if: ${{ steps.release.outputs.release_created }}
run: gzip faas_darwin_amd64 faas_linux_amd64 faas_windows_amd64.exe
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Darwin Binary
uses: actions/upload-release-asset@v1
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -49,6 +68,7 @@ jobs:
asset_content_type: application/x-gzip
- name: Upload Linux Binary
uses: actions/upload-release-asset@v1
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -58,10 +78,22 @@ jobs:
asset_content_type: application/x-gzip
- name: Upload Windows Binary
uses: actions/upload-release-asset@v1
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./faas_windows_amd64.exe.gz
asset_name: faas_windows_amd64.exe.gz
asset_content_type: application/x-gzip
- name: Create Release
id: create_release
if: ${{ steps.release.outputs.release_created }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
41 changes: 0 additions & 41 deletions .github/workflows/develop.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/main.yaml

This file was deleted.

1 change: 1 addition & 0 deletions version.txt
@@ -0,0 +1 @@
0.6.2

0 comments on commit 8a60c5e

Please sign in to comment.