Skip to content

Merge branch 'main' of https://github.com/hujun-open/k8slan #24

Merge branch 'main' of https://github.com/hujun-open/k8slan

Merge branch 'main' of https://github.com/hujun-open/k8slan #24

Workflow file for this run

name: Release Container Image
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
build-and-push:
name: Build and push image
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
env:
IMG_BASE: ${{ github.repository }}
REGISTRY: ghcr.io
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Extract Tag
run: echo "TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build manifests
run: make deploymanifests IMG=${{ env.REGISTRY }}/${{ env.IMG_BASE }}:${{ env.TAG }}
- name: Build and push image on Dockerhub
run: make docker-buildx IMG=${{ env.REGISTRY }}/${{ env.IMG_BASE }}:${{ env.TAG }} VERSION=${{ env.TAG }} IMGNOTAG=${{ env.REGISTRY }}/${{ env.IMG_BASE }}
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.ref_name }} \
--title "Release ${{ github.ref_name }}" \
--notes "Automated release for ${{ github.ref_name }}" \
all.yaml