Skip to content

chore: bump

chore: bump #18

Workflow file for this run

name: Push to production ☁️
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
jobs:
variables:
runs-on: ubuntu-latest
outputs:
sha_short: ${{ steps.variables.outputs.sha_short }}
build_date: ${{ steps.variables.outputs.build_date }}
no_v: ${{ steps.set_version.outputs.no_v }}
steps:
- name: Clone project
uses: actions/checkout@v3
- name: Get short commit hash
id: variables
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "build_date=$(date --rfc-3339=ns)" >> $GITHUB_OUTPUT
- name: Set Versions
uses: actions/github-script@v4
id: set_version
with:
script: |
const tag = context.ref.substring(10)
const no_v = tag.replace('v', '')
core.setOutput('no_v', no_v)
publish_helm:
needs: variables
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
charts_dir: ./agrold-javaweb/charts
app_version: ${{ needs.variables.outputs.no_v}}
build_n_push_prod:
needs: variables
runs-on: ubuntu-latest
strategy:
matrix:
target: [ghcr, docker]
include:
- target: ghcr
repo: ghcr.io/southgreenplatform
registry: ghcr.io
username: ${{ github.actor }}
password: GITHUB_TOKEN
- target: docker
repo: agroldapp
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to the DockerHub
if: ${{ matrix.target == 'docker' }}
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Login to ${{ matrix.target }}
if: ${{ matrix.target != 'docker' }}
uses: docker/login-action@v3.2.0
with:
registry: ${{ matrix.registry }}
username: ${{ matrix.username}}
password: ${{ secrets[matrix.password] }}
- name: Build and push Docker image
uses: docker/build-push-action@v6.3.0
with:
build-args: |
AGROLD_DESCRIPTION="Edit this description with the `agrold.description` property!"
GIT_COMMIT=${{ needs.variables.outputs.sha_short }}
BUILD_DATE=${{ needs.variables.outputs.build_date }}
push: true
context: ./agrold-javaweb
file: ./agrold-javaweb/Dockerfile
tags: ${{ matrix.repo }}/agrold:${{ needs.variables.outputs.no_v }},${{ matrix.repo }}/agrold:latest
release:
needs: [publish_helm, build_n_push_prod]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Changelog from Conventional Commits
id: changelog
uses: requarks/changelog-action@v1.10.2
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
excludeScopes: cicd,ci,cd
excludeTypes: build,docs,other,style
writeToFile: false
useGitmojis: true
includeInvalidCommits: true
- name: Create Release
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}