Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Release

Release #13

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
tag:
description: "Tag to be released (e.g., v1.0.0)"
required: true
all_platforms:
description: "Build for all platforms (linux/amd64,linux/arm64) or just linux/amd64"
required: false
type: boolean
default: false
jobs:
# Job 1: Build and Push Docker Image (Independent job)
prod-container-build:
permissions:
contents: read
packages: write
uses: scality/workflows/.github/workflows/docker-build.yaml@v2
with:
context: .
name: cosi
namespace: ${{ github.repository_owner }}
tag: ${{ inputs.tag }}
platforms: ${{ inputs.all_platforms && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
# Job 2: Package Helm Chart (Runs independently of Docker build)
package-helm-chart:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.16.2
- name: Package Helm Chart
run: |
helm package ./helm/scality-cosi-driver --version ${{ inputs.tag }} --app-version ${{ inputs.tag }}
- name: Upload Helm Chart as Artifact
uses: actions/upload-artifact@v4
with:
name: helm-chart
path: scality-cosi-driver-${{ inputs.tag }}.tgz
# Job 3: Create Docker Image Info File (Depends on Docker build)
create-docker-info:
runs-on: ubuntu-latest
needs: prod-container-build
steps:
- name: Create Docker Image Info File
run: echo "Docker image - ghcr.io/${{ github.repository_owner }}/cosi:${{ inputs.tag }}" > docker-image-info.txt
- name: Upload Docker Info as Artifact
uses: actions/upload-artifact@v4
with:
name: docker-image-info
path: docker-image-info.txt
update-gh-pages:
runs-on: ubuntu-latest
needs: package-helm-chart
steps:
- name: Check out gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages # Check out the gh-pages branch
- name: Download Helm Chart Artifact
uses: actions/download-artifact@v4
with:
name: helm-chart
- name: Update index.yaml
run: |
helm repo index . --url https://scality.github.io/cosi/
- name: Configure Git for Committing
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit and Push to gh-pages
run: |
git add index.yaml scality-cosi-driver-${{ inputs.tag }}.tgz
git commit -m "Add Helm chart version ${{ inputs.tag }} to gh-pages"
git push origin gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Job 4: Create GitHub Release (Depends on Docker info and Helm chart packaging)
create-github-release:
runs-on: ubuntu-latest
needs: [create-docker-info, package-helm-chart]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Download Helm Chart Artifact
uses: actions/download-artifact@v4
with:
name: helm-chart
- name: Download Docker Info Artifact
uses: actions/download-artifact@v4
with:
name: docker-image-info
- name: Upload Assets and Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
docker-image-info.txt
scality-cosi-driver-${{ inputs.tag }}.tgz
tag_name: ${{ inputs.tag }}
name: Release ${{ inputs.tag }}
body: "Release for tag ${{ inputs.tag }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}