Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
Improve the github actions and add codeowners (#232)
Browse files Browse the repository at this point in the history
Separate the github actions into smaller steps for us to have an easier
time to spot any issues and where these may have happened.
Also have these run in parallel when possible.

Add a CODEOWNERS file to the repo.

These github actions should now look somewhat like the following image:

![image](https://user-images.githubusercontent.com/26963810/221616619-2fb4ad01-888e-4719-95e7-c9fdd549a318.png)
  • Loading branch information
Ricardo-Osorio authored Feb 27, 2023
1 parent 65ce350 commit 11f1c59
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @storageos/controlsurface
Original file line number Diff line number Diff line change
@@ -1,41 +1,57 @@
name: Publish Release
name: Build, test and Release

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

jobs:
publish:
cancel-previous:
name: Cancel previous run
runs-on: ubuntu-latest
name: Publish Release
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout
unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
needs: cancel-previous
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Checkout code
uses: actions/checkout@v2

- name: Set Version Environment Variables
run: |
echo "VERSION_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# Remove leading v
# Do parameter expansion outside of assignment
version_tag=${GITHUB_REF#refs/tags/}
semvar=${version_tag#v}
echo "SEMANTIC_VERSION=$semvar" >> $GITHUB_ENV
echo "version is $version_tag"
echo "semvar is $semvar"
- name: Run tests
- name: Unit tests
run: make test-docker

- name: Build binaries
build-binary:
name: Build binary
runs-on: ubuntu-latest
needs: cancel-previous
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Checkout code
uses: actions/checkout@v2
- name: Build binary
run: SEMANTIC_VERSION=${{ env.SEMANTIC_VERSION }} make release-docker

- name: Create release
github-release:
name: Github Release
runs-on: ubuntu-latest
needs: [build-binary, unit-tests]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: true
Expand All @@ -47,15 +63,33 @@ jobs:
./bin/release/storageos_windows_amd64
./bin/release/storageos_windows_amd64.sha256
dockerhub-release:
name: DockerHub Release
runs-on: ubuntu-latest
needs: github-release
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Set Version Environment Variables
run: |
echo "VERSION_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# Remove leading v
# Do parameter expansion outside of assignment
version_tag=${GITHUB_REF#refs/tags/}
semvar=${version_tag#v}
echo "SEMANTIC_VERSION=$semvar" >> $GITHUB_ENV
echo "version is $version_tag"
echo "semvar is $semvar"
- name: Checkout code
uses: actions/checkout@v2
- name: Login to container registry
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_CLI_USERNAME }}
password: ${{ secrets.DOCKERHUB_CLI_PASSWORD }}

- name: Build image
run: SEMANTIC_VERSION=${{ env.SEMANTIC_VERSION }} make build-cli-image

- name: Push image
run: SEMANTIC_VERSION=${{ env.SEMANTIC_VERSION }} make push-cli-image
- name: Release github
uses: softprops/action-gh-release@v1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
StorageOS client for Mac/Linux/Windows.

See also [Command Line
Reference](http://docs.storageos.com/docs/reference/cli/).
Reference](https://docs.ondat.io/docs/reference/cli/).

## Getting started

Expand Down

0 comments on commit 11f1c59

Please sign in to comment.