Skip to content

release v0.7.0

release v0.7.0 #4

Workflow file for this run

name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
concurrency:
group: release
permissions:
contents: read
packages: write
jobs:
release:
name: "Release ${{ github.ref_name }}"
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: azure/setup-helm@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set common variables
id: variables
run: |
echo "version=${REF_NAME#v}" >> $GITHUB_OUTPUT
env:
REF_NAME: "${{ github.ref_name }}"
- name: Lint Chart
id: lint_chart
env:
version: "${{ steps.variables.outputs.version }}"
run: |
helm lint ./chart
code=0
if [[ "$(yq '.version' < ./chart/Chart.yaml)" != "${version}" ]]; then
echo "Chart's version should be $version"
code=1
fi
if [[ "$(yq '.appVersion' < ./chart/Chart.yaml)" != "${version}" ]]; then
echo "Chart's appVersion should be $version"
code=1
fi
if [[ "$(yq '.image.tag' < ./chart/values.yaml)" != "" && "$(yq '.image.tag' < ./chart/values.yaml)" != "${version}" ]]; then
echo "Chart's default value for 'image.tag' should be empty or $version"
code=1
fi
if [[ $code -ne 0 ]]; then
echo "Version linting failed, please fix and push tag again"
exit 1
fi
- name: Login to ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker - Metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
${{ steps.variables.outputs.version }}-{{ sha }}
${{ steps.variables.outputs.version }}
- name: Docker - Build and Push
uses: docker/build-push-action@v4
with:
context: ./image
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
SHIM_VERSION=${{ steps.variables.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Helm - Release
env:
version: ${{ steps.variables.outputs.version }}
run: |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io/${{ github.repository_owner }} --username ${{ github.actor }} --password-stdin
helm package ./chart --version ${{ env.version }} --app-version ${{ env.version }}
helm push ./spin-containerd-shim-installer-${{ env.version }}.tgz oci://ghcr.io/${{ github.repository_owner }}/charts
- name: clear local credentials
if: always()
run: |
rm -f ${HOME}/.docker/config.json
rm -f ${HOME}/.config/helm/registry/config.json