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

Commit

Permalink
Merge pull request #205 from storageos/add-docker-releaser
Browse files Browse the repository at this point in the history
Add docker releaser
  • Loading branch information
DavidMarchant authored Sep 20, 2022
2 parents e7b66d0 + de6b8d1 commit 9801451
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,23 @@ on:
- 'v*'

jobs:
env-set-up:
runs-on: ubuntu-latest
name: Set up environment
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=${{ env.VERSION }}
semvar=${version_tag#v}
echo "SEMANTIC_VERSION=$semvar" >> $GITHUB_ENV
publish-binaries:
runs-on: ubuntu-latest
name: Publish release binaries
name: Publish release binaries to GitHub
needs: env-set-up
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -19,7 +33,7 @@ jobs:
- name: Run tests
run: make test-docker
- name: Build binaries
run: SEMANTIC_VERSION=${GITHUB_REF#refs/*/} make release-docker
run: SEMANTIC_VERSION=${{ env.SEMANTIC_VERSION }} make release-docker
- name: Create release
uses: softprops/action-gh-release@v1
with:
Expand All @@ -31,3 +45,21 @@ jobs:
./bin/release/storageos_linux_amd64.sha256
./bin/release/storageos_windows_amd64
./bin/release/storageos_windows_amd64.sha256
dockerhub-release:
runs-on: ubuntu-18.04
name: Publish container to Dockerhub
needs: [env-set-up, publish-binaries]
steps:
- 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
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules

# version information
SEMANTIC_VERSION ?= "2.8.0"
SEMANTIC_VERSION ?= "2.8.3"

# Image URL to use all building/pushing image targets
CLI_IMAGE ?= storageos/cli:v$(SEMANTIC_VERSION)

# build flags
LDFLAGS += -X main.Version=$(SEMANTIC_VERSION)
Expand Down Expand Up @@ -95,6 +98,14 @@ else
done;
endif

.PHONY: build-cli-image
build-cli-image: ## Build operator image
docker build -t ${CLI_IMAGE} .

.PHONY: push-cli-image
push-cli-image: ## Build operator image
docker push ${CLI_IMAGE}

###############################################################################
# Pipeline targets
###############################################################################
Expand Down

0 comments on commit 9801451

Please sign in to comment.