Skip to content

Commit d42950e

Browse files
committed
Add image and chart publishing workflows
1 parent c84bf29 commit d42950e

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish artifacts
2+
3+
on:
4+
# Publish artifacts on every push to master, every tag and open pull request
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- "*"
10+
pull_request:
11+
types:
12+
- opened
13+
- synchronize
14+
- ready_for_review
15+
- reopened
16+
branches:
17+
- main
18+
19+
# Use the head ref for workflow concurrency, with cancellation.
20+
# This should mean that any previous workflows for a PR get
21+
# cancelled when a new commit is pushed.
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.head_ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
publish_images:
28+
uses: ./.github/workflows/stackhpc-publish-images.yml
29+
secrets: inherit
30+
31+
publish_charts:
32+
needs: [publish_images]
33+
uses: ./.github/workflows/stackhpc-publish-charts.yml
34+
secrets: inherit
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Helm charts
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build_push_charts:
8+
name: Build and push Helm charts
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out the repository
12+
uses: actions/checkout@v4
13+
with:
14+
# This is important for the semver action to work correctly
15+
# when determining the number of commits since the last tag
16+
fetch-depth: 0
17+
18+
- name: Get SemVer version for current commit
19+
id: semver
20+
uses: azimuth-cloud/github-actions/semver@master
21+
22+
- name: Publish Helm charts
23+
uses: azimuth-cloud/github-actions/helm-publish@master
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
version: ${{ steps.semver.outputs.version }}
27+
app-version: ${{ steps.semver.outputs.short-sha }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish container images
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build_push_images:
8+
name: Build and push images
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write # needed for signing the images with GitHub OIDC Token
13+
packages: write # required for pushing container images
14+
security-events: write # required for pushing SARIF files
15+
steps:
16+
- name: Check out the repository
17+
uses: actions/checkout@v4
18+
19+
- name: Login to GitHub Container Registry
20+
uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Get SemVer version for current commit
27+
id: semver
28+
uses: azimuth-cloud/github-actions/semver@master
29+
30+
- name: Calculate metadata for image
31+
id: image-meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: ghcr.io/stackhpc/slurm-operator
35+
# Produce the branch name or tag and the SHA as tags
36+
tags: |
37+
type=ref,event=branch
38+
type=ref,event=tag
39+
type=raw,value=${{ steps.semver.outputs.short-sha }}
40+
41+
- name: Build and push image
42+
uses: azimuth-cloud/github-actions/docker-multiarch-build-push@master
43+
with:
44+
cache-key: slurm-operator
45+
platforms: linux/amd64,linux/arm64
46+
push: true
47+
tags: ${{ steps.image-meta.outputs.tags }}
48+
labels: ${{ steps.image-meta.outputs.labels }}

0 commit comments

Comments
 (0)