-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6779b50
commit 136351a
Showing
1 changed file
with
16 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,9 @@ name: Release | |
on: | ||
push: | ||
tags: | ||
- '*' | ||
- 'v*' | ||
|
||
env: | ||
CONTROLLER: ${{ github.event.repository.name }} | ||
IMAGE_REPOSITORY: "docker.io/datainfrahq" | ||
|
||
jobs: | ||
|
@@ -17,15 +16,20 @@ jobs: | |
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
- name: Prepare | ||
id: prep | ||
run: | | ||
VERSION="${{ github.event.inputs.tag }}-${GITHUB_SHA::8}" | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
VERSION=${GITHUB_REF/refs\/tags\//} | ||
fi | ||
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ') | ||
echo ::set-output name=VERSION::${VERSION} | ||
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT" | ||
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
@@ -36,43 +40,13 @@ jobs: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
images: <docker-repo>/<image-name> | ||
tags: | | ||
type=semver,pattern={{version}} | ||
go-version: '1.20' | ||
|
||
- name: Build and Push Image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
package-and-release-chart: | ||
name: Package and Release Helm Chart | ||
needs: build-and-push-image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
|
||
- name: Package Helm Chart | ||
run: | | ||
helm package charts/<chart-name> --version ${{ github.ref_name }} --app-version ${{ github.ref_name }} | ||
working-directory: . | ||
- name: Build and push operator image with Buildx | ||
run: make docker-buildx IMG="${IMAGE_REPOSITORY}:${{ steps.prep.outputs.VERSION }}" | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
|
@@ -85,12 +59,7 @@ jobs: | |
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Helm Chart to Release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Publish Helm chart in GitHub Pages | ||
uses: stefanprodan/[email protected] | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./${{ github.ref_name }}-<chart-name>.tgz | ||
asset_name: <chart-name>.tgz | ||
asset_content_type: application/octet-stream | ||
token: ${{ secrets.GITHUB_TOKEN }} |