-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from sustainable-computing-io/gitworkflow
initial workflow
- Loading branch information
Showing
4 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Compute Version | ||
description: computes version of the operator | ||
outputs: | ||
version: | ||
description: "operator version" | ||
value: ${{ steps.version.outputs.version }} | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Generate Version | ||
id: version | ||
shell: bash | ||
run: | | ||
version="$(cat VERSION)-$(date +%Y%m%d%H%M%S)" | ||
echo VERSION=$version | ||
echo "version=$version" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Build and Publish Images | ||
description: "Publishes operator and bundle images to an Image Registry" | ||
inputs: | ||
image_registry: | ||
description: "image registry" | ||
required: true | ||
registry_login: | ||
description: "registry username" | ||
required: true | ||
registry_token: | ||
description: "registry token" | ||
required: true | ||
|
||
version: | ||
description: "operator version" | ||
required: true | ||
|
||
additional_tags: | ||
description: "additional tags for container images" | ||
required: false | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@main | ||
with: | ||
go-version-file: go.mod | ||
check-latest: true | ||
cache: true | ||
|
||
- name: Login to Image Registry | ||
uses: docker/login-action@v2 | ||
if: "!startsWith(inputs.image_registry, 'localhost')" | ||
with: | ||
registry: ${{ inputs.image_registry }} | ||
username: ${{ inputs.registry_login }} | ||
password: ${{ inputs.registry_token }} | ||
|
||
- name: Build Operator | ||
shell: bash | ||
run: | | ||
make build | ||
env: | ||
VERSION: ${{ inputs.version }} | ||
IMG: ${{ inputs.image_registry }} | ||
ADDITIONAL_TAGS: ${{ inputs.additional_tags }} | ||
|
||
- name: Push Images | ||
shell: bash | ||
if: "!startsWith(inputs.image_registry, 'localhost')" | ||
run: | | ||
make docker-build docker-push | ||
env: | ||
VERSION: ${{ inputs.version }} | ||
IMG: ${{ inputs.image_registry }} | ||
ADDITIONAL_TAGS: ${{ inputs.additional_tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Publish Images | ||
|
||
on: | ||
push: | ||
branches: [ v1alpha1 ] | ||
|
||
jobs: | ||
publish: | ||
name: Publish operator container images | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@main | ||
with: | ||
go-version-file: go.mod | ||
cache: true | ||
|
||
- uses: ./.github/compute-version | ||
id: version | ||
|
||
- name: additional tags | ||
id: additional_tags | ||
shell: bash | ||
run: | | ||
echo "result=$(git rev-parse --short HEAD),v1alpha1" >> $GITHUB_OUTPUT | ||
- name: build and publish images to external registry | ||
uses: ./.github/publish-images | ||
with: | ||
image_registry: ${{ vars.IMG_BASE }} | ||
registry_login: ${{ secrets.BOT_NAME }} | ||
registry_token: ${{ secrets.BOT_TOKEN }} | ||
version: ${{ steps.version.outputs.version }} | ||
additional_tags: ${{ steps.additional_tags.outputs.result }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |