Skip to content

Commit

Permalink
Merge pull request #164 from nitrictech/feature/release-workflow
Browse files Browse the repository at this point in the history
New dev/prod release workflow.
  • Loading branch information
tjholm authored Sep 12, 2021
2 parents 1a6009e + ae160b0 commit 6afd075
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 139 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/publish-binaries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release Binaries
on:
release:
types: [published]

jobs:
add_binaries:
name: Add Binaries to release
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/go
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16.7
- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Install modules
run: make install-tools
- name: Make binaries
run: make build-all-binaries
- name: Upload Dev
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./bin/membrane-dev
asset_name: membrane-dev
asset_content_type: application/octet-stream
- name: Upload AWS
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./bin/membrane-aws
asset_name: membrane-aws
asset_content_type: application/octet-stream
- name: Upload GCP
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./bin/membrane-gcp
asset_name: membrane-gcp
asset_content_type: application/octet-stream
- name: Upload Digital Ocean
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./bin/membrane-do
asset_name: membrane-do
asset_content_type: application/octet-stream
41 changes: 41 additions & 0 deletions .github/workflows/publish-contracts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release Contracts
on:
release:
types: [published]

jobs:
# Bump the membrane version
contract_release:
name: Add contracts to release
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/go
steps:
- name: Checkout
uses: actions/checkout@v2

# Add validate contract to the released contracts
- name: Download validate contract
run: |
mkdir -p ./contracts/validate
curl https://raw.githubusercontent.com/envoyproxy/protoc-gen-validate/v0.6.1/validate/validate.proto --output ./contracts/validate/validate.proto
# Tarball the contracts repository
- name: Archive Release
uses: thedoctor0/zip-release@master
with:
type: 'tar'
filename: 'contracts.tgz'
path: contracts

# Upload contract tarball to the releases
- name: Upload Contracts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./contracts.tgz
asset_name: contracts.tgz
asset_content_type: application/tar+gzip

Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
name: Release Docker images
on:
release:
types: [released]
types: [published]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
token: ${{secrets.GOLANG_TOKEN}}
submodules: recursive
- name: Get Tag
id: tag
run: echo ::set-output name=TAG::$(echo $GITHUB_REF | cut -d / -f 3)
# Setup docker build image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -24,6 +18,19 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Sets the latest tag to rc-latest if release was a prerelease
- name: Set latest tag RC
if: "github.event.release.prerelease"
run: |
echo "latest_tag=rc-latest" >> $GITHUB_ENV
# Uses latest tag if release was a production release
- name: Set latest tag Prod
if: "!github.event.release.prerelease"
run: |
echo "latest_tag=latest" >> $GITHUB_ENV
# Push development image
- name: Push Local Static image to Docker Hub
uses: docker/build-push-action@v2
Expand All @@ -32,8 +39,8 @@ jobs:
file: ./pkg/providers/dev/dev.dockerfile
push: true
tags: |
nitricimages/membrane-local:latest
nitricimages/membrane-local:${{ steps.tag.outputs.TAG }}
nitricimages/membrane-local:${{ env.latest_tag }}
nitricimages/membrane-local:${{ github.event.release.tag_name }}
# Push AWS image
- name: Push AWS Static image to Docker Hub
uses: docker/build-push-action@v2
Expand All @@ -42,8 +49,8 @@ jobs:
file: ./pkg/providers/aws/aws.dockerfile
push: true
tags: |
nitricimages/membrane-aws:latest
nitricimages/membrane-aws:${{ steps.tag.outputs.TAG }}
nitricimages/membrane-aws:${{ env.latest_tag }}
nitricimages/membrane-aws:${{ github.event.release.tag_name }}
# Push GCP image
- name: Push GCP Static image to Docker Hub
uses: docker/build-push-action@v2
Expand All @@ -52,8 +59,8 @@ jobs:
file: ./pkg/providers/gcp/gcp.dockerfile
push: true
tags: |
nitricimages/membrane-gcp:latest
nitricimages/membrane-gcp:${{ steps.tag.outputs.TAG }}
nitricimages/membrane-gcp:${{ env.latest_tag }}
nitricimages/membrane-gcp:${{ github.event.release.tag_name }}
# Push Azure image
- name: Push Azure Static image to Docker Hub
uses: docker/build-push-action@v2
Expand All @@ -62,8 +69,8 @@ jobs:
file: ./pkg/providers/azure/azure.dockerfile
push: true
tags: |
nitricimages/membrane-azure:latest
nitricimages/membrane-azure:${{ steps.tag.outputs.TAG }}
nitricimages/membrane-azure:${{ env.latest_tag }}
nitricimages/membrane-azure:${{ github.event.release.tag_name }}
# Push Digital Ocean image
- name: Push Digital Ocean image to Docker Hub
uses: docker/build-push-action@v2
Expand All @@ -72,5 +79,5 @@ jobs:
file: ./pkg/providers/do/do.dockerfile
push: true
tags: |
nitricimages/membrane-do:latest
nitricimages/membrane-do:${{ steps.tag.outputs.TAG }}
nitricimages/membrane-do:${{ env.latest_tag }}
nitricimages/membrane-do:${{ github.event.release.tag_name }}
121 changes: 0 additions & 121 deletions .github/workflows/publish.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/release-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Production Release
on:
pull_request:
types: [closed]
branches:
- 'main'
jobs:
# Bump the membrane version
version_bump:
if: github.event.pull_request.merged == true
name: Bump Version and Create Release
runs-on: ubuntu-latest
outputs:
version_id: ${{ steps.tag_version.outputs.new_tag }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
# Use GITHUB_TOKEN here to prevent further workflows
# generated on 'tag' action
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
id: create_release
uses: actions/create-release@v1
env:
# Use NITRIC_BOT_TOKEN here to
# trigger release 'published' workflows
GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
Loading

0 comments on commit 6afd075

Please sign in to comment.