Skip to content

Commit

Permalink
add init release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Wenzel authored and Felix Wenzel committed Jan 9, 2024
1 parent 4a67a0d commit 130346a
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 10 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Init Release
on:
workflow_dispatch:
inputs:
TARGET_VERSION:
description: 'TARGET_VERSION to build manifests (e.g. 2.5.0-rc1) Note: the `v` prefix is not used'
required: true
type: string

jobs:
init-release:
name: Create new release for ${{ inputs.TARGET_VERSION }}
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main

- name: Check if TARGET_VERSION is well formed.
run: |
set -xue
# Target version must not contain 'v' prefix
if echo "${{ inputs.TARGET_VERSION }}" | grep -e '^v'; then
echo "::error::Target version '${{ inputs.TARGET_VERSION }}' should not begin with a 'v' prefix, refusing to continue." >&2
exit 1
fi
- name: Create release
run: |
gh release create v${{ inputs.TARGET_VERSION }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 8 additions & 7 deletions .github/workflows/push-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
name: Deploy Images to GHCR

on:
push:
tags:
- "v*.*.*"
workflow_run:
workflows: [Init Release]
types:
- completed

jobs:
push-image:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: "./azure-clientid-syncer"
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@main
Expand All @@ -23,7 +22,9 @@ jobs:
password: ${{secrets.GITHUB_TOKEN}}

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
run: echo "RELEASE_VERSION=$(gh release view --jq '.name[1:]' --json name)" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/push-helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Charts

on:
workflow_run:
workflows: [Init Release]
types:
- completed

jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Replace version
run: |
RELEASE_VERSION=$(gh release view --jq '.name[1:]' --json name)
cd charts/azure-clientid-syncer-webhook
sed -i "s@version:.*@version: $RELEASE_VERSION@g" Chart.yaml
sed -i "s@appVersion:.*@appVersion: $RELEASE_VERSION@g" Chart.yaml
cat Chart.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
4 changes: 2 additions & 2 deletions charts/azure-clientid-syncer-webhook/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: azure-clientid-syncer-webhook
description: A Helm chart to install the azure-clientid-syncer webhook
type: application
version: 0.0.1
appVersion: 0.0.1
version: 0.0.0
appVersion: 0.0.0
home: https://github.com/shiftavenue/azure-clientid-syncer
sources:
- https://github.com/shiftavenue/azure-clientid-syncer
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/shiftavenue/aks-clientid-syncer
module github.com/shiftavenue/azure-clientid-syncer

go 1.21.5

Expand Down

0 comments on commit 130346a

Please sign in to comment.