Merge pull request #476 from stakater-lab/update #32
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
name: Push | |
on: | |
push: | |
branches: main | |
env: | |
DOCKER_FILE_PATH: Dockerfile | |
jobs: | |
build-test-code: | |
runs-on: ubuntu-latest | |
name: Build | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Generate Tag | |
id: generate_tag | |
uses: anothrNick/github-tag-action@1.61.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: false | |
DEFAULT_BUMP: patch | |
RELEASE_BRANCHES: main | |
DRY_RUN: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io/stakater-lab | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate image repository path | |
run: | | |
echo IMAGE_REPOSITORY=$(echo ghcr.io/stakater-lab/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ${{ env.DOCKER_FILE_PATH }} | |
pull: true | |
push: true | |
cache-to: type=inline | |
tags: | | |
${{ env.IMAGE_REPOSITORY }}:v${{ steps.generate_tag.outputs.new_tag }} | |
labels: | | |
org.opencontainers.image.source=${{ github.event.repository.clone_url }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
- name: Package and Push Helm Chart | |
run: | | |
sed -i "s/^version:.*/version: ${{ steps.generate_tag.outputs.new_tag }}/" deploy/Chart.yaml | |
helm dependency update deploy/ | |
helm package deploy/ | |
helm push stakater-nordmart-review-${{ steps.generate_tag.outputs.new_tag }}.tgz oci://ghcr.io/stakater-lab/charts | |
- name: Push Latest Tag | |
uses: anothrNick/github-tag-action@1.66.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: true | |
RELEASE_BRANCHES: main | |
DEFAULT_BUMP: patch |